Source Control

4 views
Skip to first unread message

Bill Farrell

unread,
Aug 26, 2016, 9:58:01 AM8/26/16
to InterSystems: MV Community
Is anyone else besides me (crazy enough to try) using Git as a source control repo? I've got every other command working okay (enough) to get by with except for the "git commit" command. Now, mind that I'm perfectly comfortable using Cache in either the MV or COS side of the house. Git ain' nu'n but some voodoo. (Observation: hooking source control to Studio is voodoo enough on its own... just sayin'.) 

In my source control class for Studio I have commands attached to a menu. The method for commit looks like this:

Method gitCommit(ByRef args As EasyCSP.Core.HashArray = "") As %Status [ Language = mvbasic ]
{
    crt "Begin git commit"
    * Init the source control directory. It doesn't hurt to do this more than once.
    * https://git-scm.com/docs/git-init
    @ME->setExportDir() ; * initialize the export directory
    
    * Commit changes to local the repo. This updates .git data and prepares
    * for a git push.
    cmd = "cd " : @ME->RepoCloneDirectory : "; git nccommit"
    crt; crt "Begin commit with " : cmd
    pcperform cmd capturing reply
    crt ereplace(reply, @fm, char(13):char(10))
    
    return 1
}

In the output window in Studio I see this:

Begin commit with cd /home/ensemble/source_control/EasyCSP_RC1; git nccommit

(No reply. Just a blank line from a non-response.)

Having tried every other permutation to get some reaction out of the commit command I scoured around on StackOverflow and found this gem:

git config --global alias.nccommit 'commit -a --allow-empty-message -m ""'

which works lovely at the command line so I thought maybe if the quotes for message and anything else in the command line passed by the PCPERFORM might be throwing the shell off, maybe that would be the ticket. It seems the shell-out mechanism doesn't really like anything with quotes in it so I removed those from the other commands. I had the (mistaken) notion that making an alias in git would help the commit. I even tried including the set alias command in the command-line I'm passing via PCPERFORM.

Nut'n'honey. The add and push commands work nicely (enough for me at the moment). It's just the one commit command that's being a pain.

It doesn't hurt to ask. It's not an earth-shaking problem. It would just be nice to get Studio and git playing (reasonably) nicely. I've otherwise finished my site-building framework so it's past time to have it backed up somewhere besides my PC.

Thanks!
Bill

Edward Clark

unread,
Aug 26, 2016, 10:20:31 AM8/26/16
to InterSy...@googlegroups.com

This would be a good thing to take to a wider audience on the developer community https://community.intersystems.com. Someone there may already have a class for git.

 

Is this maybe a user permissions or environment problem? The shell created by pcperform running in studio runs as the cache service user. On windows, that’s the SYSTEM user, and on linux it defaults to cacheusr,  unless you change it during the install. Try displaying the output from a PCPERFORM “set” to see what the environment is before running the git command.

--
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-...@googlegroups.com.
To post to this group, send email to InterSy...@googlegroups.com.
Visit this group at https://groups.google.com/group/InterSystems-MV.
For more options, visit https://groups.google.com/d/optout.

James Westley Farrell

unread,
Aug 26, 2016, 10:45:37 AM8/26/16
to intersystems-mv
I tried the set command and found some permissions problems. I had created the repo as root and failed to inform git about cacheusr. I really thought I was on to something there, trying "su - cacheusr" to "be" Cache for a moment or three.

I got it happy at the command line as cacheusr. I copied and pasted the command I'm issuing from the PCPERFORM and that works at the command line. At one point I redid the method in COS and used $ZF(-1...) but got exactly the same result.

I even changed the repo directory's owner and group to cacheusr: so that any git command worked nicely at the command line.

Yeah, it's true someone more than likely already has a Studio git-class but I'd like to try to figure this out (with a few hints) so I understand it fully. I'll piddle with it a bit more before I give up and go to the wider community. It's clear I'm missing something small but important.

Thanks!!
Bill

"He is your friend, your partner, your defender, your dog. You are his life, his love, his leader. He will be yours, faithful and true, to the last beat of his heart. You owe it to him to be worthy of such devotion" -- Unknown

To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-MV+unsubscribe@googlegroups.com.
To post to this group, send email to InterSystems-MV@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-MV+unsubscribe@googlegroups.com.
To post to this group, send email to InterSystems-MV@googlegroups.com.

Edward Clark

unread,
Aug 26, 2016, 11:08:09 AM8/26/16
to InterSy...@googlegroups.com

You didn’t mention anything about environment variables. Did you have to change any, to get your command to work as cacheusr from the command line, or did you have some already set? I’ve found on some platforms that “su – user” sometimes doesn’t completely eradicate the footprint of the user you logged in as.

If environment variables are involved, and you had to change any, you might also have to restart cache for those variables to take effect in the process that studio’s command run in. Maybe double-check the “set” output in studio with your terminal “set” output

To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-...@googlegroups.com.
To post to this group, send email to InterSy...@googlegroups.com.

--

You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-...@googlegroups.com.
To post to this group, send email to InterSy...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-...@googlegroups.com.
To post to this group, send email to InterSy...@googlegroups.com.

James Westley Farrell

unread,
Aug 26, 2016, 12:17:30 PM8/26/16
to intersystems-mv
Interesting thought and I went down that path. Actually, no, I didn't change any shell environment variables. I did have to do a git remote set-url master ... a git config --global user.name ... and user.email.

I did add a "set" to the end of the command being issued from Cache and got a reply back. Nothing stands out as being obviously wrong. The path includes /usr/bin where git lives.

There are probably a lot easier solutions to work with than git. I just started there because it's slightly more familiar to me than the other open source solutions. In the final analysis I don't mind typing the few commands necessary to push stuff up to my gitHub repo. I have the Studio reliably exporting things into my local repo (classes, routines, globals, and CSP items). That's good enough for now. All I wanted was to make sure that I have a backup somewhere other than my PC and somewhere not in my house. For now, that works and leaves this project for another day when there's fiddle-around time.

I'm going to back-burner the git interface for the moment. I have a demo of my framework coming up so I'm going to get my laptop ready

Thanks!!
Bill

"He is your friend, your partner, your defender, your dog. You are his life, his love, his leader. He will be yours, faithful and true, to the last beat of his heart. You owe it to him to be worthy of such devotion" -- Unknown

To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-MV+unsubscribe@googlegroups.com.
To post to this group, send email to InterSystems-MV@googlegroups.com.

--

You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-MV+unsubscribe@googlegroups.com.
To post to this group, send email to InterSystems-MV@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-MV+unsubscribe@googlegroups.com.
To post to this group, send email to InterSystems-MV@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-MV+unsubscribe@googlegroups.com.
To post to this group, send email to InterSystems-MV@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages