summaryrefslogtreecommitdiff
path: root/git-merge-recursive.py
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-11 01:55:52 -0800
committerJunio C Hamano <junkio@cox.net>2005-12-11 01:55:52 -0800
commit157dc07368faf6537af1d2ce676a4f2dda2f71a6 (patch)
tree8b0ce228a65a5a592b099f7c096e80ba8df77981 /git-merge-recursive.py
parent28e77a81647584bfbe112f19e12e9952ab0b2fab (diff)
downloadgit-157dc07368faf6537af1d2ce676a4f2dda2f71a6.tar.gz
merge-recursive: cleanup setIndexStages
Fredrik points out there is a useful wrapper runProgram() used everywhere that we can use to feed input into subprocess. Use it to catch errors from the subprocess; it is a good cleanup as well. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-merge-recursive.py')
-rwxr-xr-xgit-merge-recursive.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/git-merge-recursive.py b/git-merge-recursive.py
index 767b13c927..f1320a6958 100755
--- a/git-merge-recursive.py
+++ b/git-merge-recursive.py
@@ -284,17 +284,11 @@ def setIndexStages(path,
oSHA1, oMode,
aSHA1, aMode,
bSHA1, bMode):
- prog = ['git-update-index', '-z', '--index-info']
- proc = subprocess.Popen(prog, stdin=subprocess.PIPE)
- pipe = proc.stdin
- # Clear stages first.
- pipe.write("0 " + ("0" * 40) + "\t" + path + "\0")
- # Set stages
- pipe.write("%o %s %d\t%s\0" % (oMode, oSHA1, 1, path))
- pipe.write("%o %s %d\t%s\0" % (aMode, aSHA1, 2, path))
- pipe.write("%o %s %d\t%s\0" % (bMode, bSHA1, 3, path))
- pipe.close()
- proc.wait()
+ runProgram(['git-update-index', '-z', '--index-info'],
+ input="0 " + ("0" * 40) + "\t" + path + "\0" + \
+ "%o %s %d\t%s\0" % (oMode, oSHA1, 1, path) + \
+ "%o %s %d\t%s\0" % (aMode, aSHA1, 2, path) + \
+ "%o %s %d\t%s\0" % (bMode, bSHA1, 3, path))
def removeFile(clean, path):
updateCache = cacheOnly or clean
@@ -724,7 +718,6 @@ def processRenames(renamesA, renamesB, branchNameA, branchNameB):
cleanMerge = False
if not cacheOnly:
- # Stuff stage1/2/3
setIndexStages(ren1.dstName,
oSHA1, oMode,
aSHA1, aMode,