* [PATCH] tg-push: Filter out plain SHA1s from being pushed.
@ 2010-02-27 22:09 Thomas Schwinge
2010-02-28 10:18 ` Uwe Kleine-König
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Schwinge @ 2010-02-27 22:09 UTC (permalink / raw)
To: u.kleine-koenig; +Cc: git, Thomas Schwinge
Otherwise, problems arise when branches depend (via .topdeps) on SHA1s:
$ tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
fatal: The remote end hung up unexpectedly
---
Hello!
I was facing the following problem:
thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ bash -v -x /usr/bin/tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
[...]
++ read _dep
++ missing_deps=
++ rm /tmp/tg-depsfile.nCfywI
++ return 0
++ xargs git push tmp
++ sort -u /tmp/tg-push-listfile.sZeHIr
fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
fatal: The remote end hung up unexpectedly
rm -f "/tmp/tg-push-listfile.sZeHIr"
+ rm -f /tmp/tg-push-listfile.sZeHIr
That's the actual problem:
thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ git push tmp 77c84aeb81808c3109665949448dba59965c391e
fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
fatal: The remote end hung up unexpectedly
... which is due to:
$ git show t/____longjmp_chk_cleanup_linux_x86_64:.topdeps
77c84aeb81808c3109665949448dba59965c391e
All other parts (at least those I tested / got to use so far) work just
fine when passing SHA1s.
Here is a patch to make this work for tg push, too.
thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
Counting objects: 196207, done.
Compressing objects: 100% (32953/32953), done.
Writing objects: 100% (196207/196207), 66.45 MiB | 4047 KiB/s, done.
Total 196207 (delta 163379), reused 191592 (delta 159243)
To /media/Stalin/tmp/glibc
* [new branch] t/____longjmp_chk_cleanup_linux_x86_64 -> t/____longjmp_chk_cleanup_linux_x86_64
* [new branch] refs/top-bases/t/____longjmp_chk_cleanup_linux_x86_64 -> refs/top-bases/t/____longjmp_chk_cleanup_linux_x86_64
tg-push.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tg-push.sh b/tg-push.sh
index cd208a0..28cad81 100644
--- a/tg-push.sh
+++ b/tg-push.sh
@@ -71,6 +71,9 @@ for name in $branches; do
$recurse_deps && [ -n "$_dep_is_tgish" ] &&
no_remotes=1 recurse_deps push_branch "$name"
+ # filter out plain SHA1s
# remove multiple occurrences of the same branch
- sort -u "$_listfile" | xargs git push $dry_run "$remote"
+ grep -vE '^[0-9a-f]{40}$' < "$_listfile" \
+ | sort -u \
+ | xargs git push $dry_run "$remote"
done
--
1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tg-push: Filter out plain SHA1s from being pushed.
2010-02-27 22:09 [PATCH] tg-push: Filter out plain SHA1s from being pushed Thomas Schwinge
@ 2010-02-28 10:18 ` Uwe Kleine-König
2010-02-28 13:57 ` Thomas Schwinge
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2010-02-28 10:18 UTC (permalink / raw)
To: Thomas Schwinge; +Cc: git
Hello,
On Sat, Feb 27, 2010 at 11:09:08PM +0100, Thomas Schwinge wrote:
> Otherwise, problems arise when branches depend (via .topdeps) on SHA1s:
>
> $ tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
> fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
> fatal: The remote end hung up unexpectedly
> ---
>
> Hello!
>
> I was facing the following problem:
>
> thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ bash -v -x /usr/bin/tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
> [...]
> ++ read _dep
> ++ missing_deps=
> ++ rm /tmp/tg-depsfile.nCfywI
> ++ return 0
> ++ xargs git push tmp
> ++ sort -u /tmp/tg-push-listfile.sZeHIr
> fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
> fatal: The remote end hung up unexpectedly
> rm -f "/tmp/tg-push-listfile.sZeHIr"
> + rm -f /tmp/tg-push-listfile.sZeHIr
>
> That's the actual problem:
>
> thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ git push tmp 77c84aeb81808c3109665949448dba59965c391e
> fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
> fatal: The remote end hung up unexpectedly
>
> ... which is due to:
>
> $ git show t/____longjmp_chk_cleanup_linux_x86_64:.topdeps
> 77c84aeb81808c3109665949448dba59965c391e
>
> All other parts (at least those I tested / got to use so far) work just
> fine when passing SHA1s.
>
> Here is a patch to make this work for tg push, too.
>
> thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
> Counting objects: 196207, done.
> Compressing objects: 100% (32953/32953), done.
> Writing objects: 100% (196207/196207), 66.45 MiB | 4047 KiB/s, done.
> Total 196207 (delta 163379), reused 191592 (delta 159243)
> To /media/Stalin/tmp/glibc
> * [new branch] t/____longjmp_chk_cleanup_linux_x86_64 -> t/____longjmp_chk_cleanup_linux_x86_64
> * [new branch] refs/top-bases/t/____longjmp_chk_cleanup_linux_x86_64 -> refs/top-bases/t/____longjmp_chk_cleanup_linux_x86_64
>
>
> tg-push.sh | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/tg-push.sh b/tg-push.sh
> index cd208a0..28cad81 100644
> --- a/tg-push.sh
> +++ b/tg-push.sh
> @@ -71,6 +71,9 @@ for name in $branches; do
> $recurse_deps && [ -n "$_dep_is_tgish" ] &&
> no_remotes=1 recurse_deps push_branch "$name"
>
> + # filter out plain SHA1s
> # remove multiple occurrences of the same branch
> - sort -u "$_listfile" | xargs git push $dry_run "$remote"
> + grep -vE '^[0-9a-f]{40}$' < "$_listfile" \
> + | sort -u \
> + | xargs git push $dry_run "$remote"
> done
probably this is good enough. Still I wonder if there is a better way
to detect if a given rev is a sha1 or a branch.
test "$(git rev-parse "$rev")" = "$rev"
comes to mind. Anybody who gives names to branches that match
^[0-9a-f]{40}$ has other problems probably.
I think I will take it anyhow (and fix up the broken indention).
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] tg-push: Filter out plain SHA1s from being pushed.
2010-02-28 10:18 ` Uwe Kleine-König
@ 2010-02-28 13:57 ` Thomas Schwinge
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Schwinge @ 2010-02-28 13:57 UTC (permalink / raw)
To: u.kleine-koenig, u.kleine-koenig; +Cc: Thomas Schwinge, git
Otherwise, problems arise when branches depend (via .topdeps) on SHA1s:
$ tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
fatal: The remote end hung up unexpectedly
Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
---
Hello!
I was facing the following problem:
thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ bash -v -x /usr/bin/tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
[...]
++ read _dep
++ missing_deps=
++ rm /tmp/tg-depsfile.nCfywI
++ return 0
++ xargs git push tmp
++ sort -u /tmp/tg-push-listfile.sZeHIr
fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
fatal: The remote end hung up unexpectedly
rm -f "/tmp/tg-push-listfile.sZeHIr"
+ rm -f /tmp/tg-push-listfile.sZeHIr
That's the actual problem:
thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ git push tmp 77c84aeb81808c3109665949448dba59965c391e
fatal: 77c84aeb81808c3109665949448dba59965c391e cannot be resolved to branch.
fatal: The remote end hung up unexpectedly
... which is due to:
$ git show t/____longjmp_chk_cleanup_linux_x86_64:.topdeps
77c84aeb81808c3109665949448dba59965c391e
All other parts (at least those I tested / got to use so far) work just
fine when passing SHA1s.
Here is a patch to make this work for tg push, too.
thomas@dirichlet:~/tmp/source/glibc/git/glibc.hurd $ tg push -r tmp t/____longjmp_chk_cleanup_linux_x86_64
Counting objects: 196207, done.
Compressing objects: 100% (32953/32953), done.
Writing objects: 100% (196207/196207), 66.45 MiB | 4047 KiB/s, done.
Total 196207 (delta 163379), reused 191592 (delta 159243)
To /media/Stalin/tmp/glibc
* [new branch] t/____longjmp_chk_cleanup_linux_x86_64 -> t/____longjmp_chk_cleanup_linux_x86_64
* [new branch] refs/top-bases/t/____longjmp_chk_cleanup_linux_x86_64 -> refs/top-bases/t/____longjmp_chk_cleanup_linux_x86_64
tg-push.sh | 3 +++
tg.sh | 7 +++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tg-push.sh b/tg-push.sh
index cd208a0..089f885 100644
--- a/tg-push.sh
+++ b/tg-push.sh
@@ -53,6 +53,9 @@ push_branch()
# if so desired omit non tgish deps
$tgish_deps_only && [ -z "$_dep_is_tgish" ] && return 0
+ # filter out plain SHA1s
+ is_sha1 "$_dep" && return 0
+
echo "$_dep" >> "$_listfile"
[ -z "$_dep_is_tgish" ] ||
echo "top-bases/$_dep" >> "$_listfile"
diff --git a/tg.sh b/tg.sh
index 1f6d3da..91c374a 100644
--- a/tg.sh
+++ b/tg.sh
@@ -126,6 +126,13 @@ branch_annihilated()
test "$(git rev-parse "$mb^{tree}")" = "$(git rev-parse "$_name^{tree}")";
}
+# is_sha1 REF
+# Whether REF is a SHA1 (compared to a symbolic name).
+is_sha1()
+{
+ [ "$(git rev-parse "$1")" = "$1" ]
+}
+
# recurse_deps CMD NAME [BRANCHPATH...]
# Recursively eval CMD on all dependencies of NAME.
# CMD can refer to $_name for queried branch name,
--
tg: (341a371..) t/tg_push_no_SHA1 (depends on: master)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-28 13:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-27 22:09 [PATCH] tg-push: Filter out plain SHA1s from being pushed Thomas Schwinge
2010-02-28 10:18 ` Uwe Kleine-König
2010-02-28 13:57 ` Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).