Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix a concurrency issue where in a multiuser env, g sync would fail b…

…ecause it lost permissions to a tmp file
  • Loading branch information...
commit dc632bc24e2bc19032cf26da7edce0e42dd76c36 1 parent d494457
@orefalo authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 cmds/g2-sync.sh
View
10 cmds/g2-sync.sh
@@ -17,9 +17,13 @@ $("$GIT_EXE" g2iswip $remote) || exit 1;
"$GIT_EXE" fetch || exit $?;
$("$GIT_EXE" g2isforced $remote) && fatal "It appears the history of the branch was changed on the server." && error " please issue a ${boldon}g rs upstream${boldoff} or a ${boldon}g rb $remote${boldoff} to resume";
branch=$("$GIT_EXE" branch | grep "*" | sed "s/* //")
-"$GIT_EXE" rev-list --left-right $branch...$remote -- 2> /dev/null > /tmp/git_upstream_status_delta
-lchg=$(grep -c "^<" /tmp/git_upstream_status_delta);
-rchg=$(grep -c "^>" /tmp/git_upstream_status_delta);
+
+# count the number of changes in/out
+deltafile="/tmp/delta$RANDOM"
+"$GIT_EXE" rev-list --left-right "$branch...$remote" -- 2> /dev/null > "$deltafile"
+lchg=$(grep -c "^<" "$deltafile");
+rchg=$(grep -c "^>" "$deltafile");
+rm "$deltafile"
[[ $rchg -gt 0 ]] && { "$GIT_EXE" rebase $remote || {
unmerged=$("$GIT_EXE" ls-files --unmerged)
Please sign in to comment.
Something went wrong with that request. Please try again.