Thread (26 messages) flat view 26 messages, 3 authors, 2016-06-15

Re: [PATCH v4 09/14] remote-testgit: report success after an import

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:55:11

On Fri, Nov 2, 2012 at 2:58 PM, Stefano Lattarini
[off-list ref] wrote:
On 11/02/2012 03:02 AM, Felipe Contreras wrote:
quoted
Doesn't make a difference for the tests, but it does for the ones
seeking reference.

Signed-off-by: Felipe Contreras <redacted>
---
 git-remote-testgit | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff --git a/git-remote-testgit b/git-remote-testgit
index 6c348b0..4e8b356 100755
--- a/git-remote-testgit
+++ b/git-remote-testgit
@@ -59,7 +59,18 @@ while read line; do
             sed -e "s#refs/heads/#${prefix}/heads/#g"
         ;;
     export)
+        declare -A before after
+
If you convert this script to be a valid POSIX shell script (as I've
suggested in my reply to [PATCH v4 04/14]), you'll need to get rid of
this bashism (and those below) as well.
Yeah, but I don't want to. I originally used transitory files, and
used esoteric options of diff to do the same (which were probably not
portable).

In the end I liked this approach much better.

If you have a solution for this that works in POSIX shell, I'll be
glad to consider it, but for the moment, I think a simple, easy to
understand and maintain code is more important, and if it needs bash,
so be it.
quoted
+        eval $(git for-each-ref --format='before[%(refname)]=%(objectname)')
+
         git fast-import --{import,export}-marks="$testgitmarks" --quiet
+
+        eval $(git for-each-ref --format='after[%(refname)]=%(objectname)')
+
+        for ref in "${!after[@]}"; do
+            test "${before[$ref]}" ==  "${after[$ref]}" && continue
+            echo "ok $ref"
+        done
         echo
         ;;
     '')
Cheers.

-- 
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help