[TopGit PATCH v2 2/3] tg-push: prevent multiple occurences of branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So, I finally tried the tg-push and got a lot of warnings and errors:

warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master
warning, no base found top-bases/master


error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/master
error: Ref refs/heads/bw/log is at a16df35cc7009b36f6f71717ae3d9a3dc29987da but expected 0000000000000000000000000000000000000000
error: failed to lock refs/heads/bw/log
error: Ref refs/top-bases/bw/log is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
error: failed to lock refs/top-bases/bw/log

 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] master -> master (failed to lock)
 ! [remote rejected] bw/log -> bw/log (failed to lock)
 ! [remote rejected] refs/top-bases/bw/log -> refs/top-bases/bw/log (failed to lock)

Also the result was ok this output is defintive not ok.

To prevent multiple occurences of the same branchname we sort -u these at the
end, as suggested by Uwe.

Regards,
Bert

Signed-off-by: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx>

---
 tg-push.sh |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/tg-push.sh b/tg-push.sh
index 40849ae..8e1b43f 100644
--- a/tg-push.sh
+++ b/tg-push.sh
@@ -45,27 +45,32 @@ for name in $branches; do
 	ref_exists "$name" || die "detached HEAD? Can't push $name"
 done
 
+_listfile="$(mktemp -t tg-push-listfile.XXXXXX)"
+trap "rm -f \"$_listfile\"" 0
+
 push_branch()
 {
 	# if so desired omit non tgish deps
 	$tgish_deps_only && [ -z "$_dep_is_tgish" ] && return 0
 
-	echo "$_dep"
+	echo "$_dep" >> "$_listfile"
 	[ -z "$_dep_is_tgish" ] ||
-		echo "top-bases/$_dep"
+		echo "top-bases/$_dep" >> "$_listfile"
 }
 
 for name in $branches; do
-	list="$(
-		# deps
-		if $recurse_deps; then
-			no_remotes=1 recurse_deps push_branch "$name"
-		fi
-		# current branch
-		_dep="$name"
-		_dep_is_tgish=1
-		push_branch "$name"
-	)"
-	echo "pushing:"; echo $list
-	git push $dry_run "$remote" $list
+	# current branch
+	# re-use push_branch, which expects some pre-defined variables
+	_dep="$name"
+	_dep_is_tgish=1
+	ref_exists "top-bases/$_dep" ||
+		_dep_is_tgish=
+	push_branch "$name"
+
+	# deps
+	$recurse_deps &&
+		no_remotes=1 recurse_deps push_branch "$name"
+
+	# remove multiple occurrences of the same branch
+	sort -u "$_listfile" | xargs git push $dry_run "$remote"
 done
-- 
tg: (8f4fb90..) bw/push-fixes (depends on: bw/push-remove-useless-warning)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]