Re: How to sync changes in GIT to ClearCase or How to get the list of files changed in GIT for a specific branch
From: Chris Packham <hidden>
Date: 2016-06-15 22:46:43
On Fri, May 8, 2009 at 7:04 AM, Senthil Kumar [off-list ref] wrote:
Hey Chris,
First thanks for giving me the knowledge transfer and i really appreciate
it. Am working on the sync stuff now, but i have an issue in a perl script
in post-update hook.
Have a doubt here, am writing a post-update hook in perl, so that whenever
a user pushes code from their local repo to the bare public repo, the
post-update hook triggers so as to pull changes from the abre public repo to
the actual parent data repo.
My data repo: /snaps4/searumugam/spec-repo/mydodo.repo
My bare repo: /snaps4/searumugam/spec-repo/mydodo.bare
My local repo: /snaps4/searumugam/githome/searumugam_mydodo
here is what i have in the script (left), and the output i get is in blue
(right)
The concept: First when a user pushes to bare repo -
/snaps4/searumugam/spec-repo/mydodo.bare, the post-update trigger starts, it
shd cd into the data repo path (/snaps4/searumugam/spec-repo/mydodo.repo)
and initiate a 'git pull'
The $data path has the correct path - my data repo path, where the pull will
be initiated,
print "\nData Path: $data_path\n"; Data Path:
/snaps4/searumugam/spec-repo/mydodo.repo/
chdir ($data_path);
system("pwd");
/snaps4/searumugam/spec-repo/mydodo.repo
system("git pull"); fatal: Not a git
repository: '.'
system("pwd");
/snaps4/searumugam/spec-repo/mydodo.repo
i even tried with system("/usr/libexec/git-core/git-pull"); but its saying
the same error. But when i do it manually in the same direcotory it works
Manual pull, when am in the same directory.
rndhyper1:/snaps4/searumugam/spec-repo/mydodo.repo 30> pwd
/snaps4/searumugam/spec-repo/mydodo.repo
rndhyper1:/snaps4/searumugam/spec-repo/mydodo.repo 31> git pull
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From /snaps4/searumugam/spec-repo/mydodo.bare
cb9f659..2c5bca8 master -> origin/master
Updating cb9f659..2c5bca8
Fast forward
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 final111223
create mode 100644 final1112233
Am i doing something wrong, or should i execute 'git pull' in a different
manner?
hope you could help mein this.
Thanks & Regards
Senthil A Kumar
Like I say not exactly an expert. But it looks like when run in this
manner 'git pull' is unable to figure out the location of the .git
directory. Try something like.
system("GIT_DIR=$data_path.git; git pull");
There were some other replies to your original post that promising for
the cc-to-git-and-back aspect. Looking into them may save you a lot of
time.
Good luck.