git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] pack-objects: Allow missing base objects when creating thin packs

From
Shawn O. Pearce <spearce@spearce.org>
Date
Aug 12, 2008, 18:18 UTC
Message-ID
<20080812181843.GD31092@spearce.org>
In-Reply-To
<alpine.LFD.1.10.0808121402440.22892@xanadu.home>
Nicolas Pitre <nico@cam.org> wrote:
Show 17 quoted lines
> On Tue, 12 Aug 2008, Shawn O. Pearce wrote:
> > +# Clone patch_clone indirectly by cloning base and fetching.
> > +#
> > +test_expect_success \
> > +    'indirectly clone patch_clone' \
> > +    '(mkdir user_clone &&
> > +      cd user_clone &&
> > +      git init &&
> > +      git pull ../.git &&
> > +      test $(git rev-parse HEAD) = $B
> > +
> > +      git pull ../patch_clone/.git &&
> > +      test $(git rev-parse HEAD) = $C
> > +     )
> > +    '
> 
> What if the first test command fails?  Won't its result be ignored?

Isn't the exit status of the subshell the exit status of the last command in the subshell?

I just changed the test line to compare to "x$C" instead of $C and it correctly detected the error condition:

$ git diff
diff --git a/t/t5306-pack-nobase.sh b/t/t5306-pack-nobase.sh
index 503e9d4..7c55e9e 100755
--- a/t/t5306-pack-nobase.sh
+++ b/t/t5306-pack-nobase.sh
@@ -62,7 +62,7 @@ test_expect_success \
       test $(git rev-parse HEAD) = $B

       git pull ../patch_clone/.git &&
-      test $(git rev-parse HEAD) = $C
+      test $(git rev-parse HEAD) = x$C
      )
     '

$ ./t5306-pack-nobase.sh
*   ok 1: setup base
*   ok 2: setup patch_clone
* FAIL 3: indirectly clone patch_clone
        (mkdir user_clone &&
              cd user_clone &&
              git init &&
              git pull ../.git &&
              test $(git rev-parse HEAD) = $B

              git pull ../patch_clone/.git &&
              test $(git rev-parse HEAD) = x$C
             )

*   ok 4: clone of patch_clone is incomplete
* failed 1 among 4 test(s)
-- 
Shawn.
Previous: Nicolas PitreNext: Nicolas Pitre
Message 9 of 12 in “RFC: Allow missing objects during packing”
  1. Shawn O. PearceAug 11, 2008
  2. Junio C HamanoAug 11, 2008
  3. Shawn O. PearceAug 11, 2008
  4. Shawn O. PearceAug 12, 2008
  5. Junio C HamanoAug 12, 2008
  6. Nicolas PitreAug 12, 2008
  7. pack-objects: Allow missing base objects when creating thin packsShawn O. Pearce, Aug 12, 2008
  8. Nicolas PitreAug 12, 2008
  9. Shawn O. PearceAug 12, 2008
  10. Nicolas PitreAug 12, 2008
  11. pack-objects: Allow missing base objects when creating thin packsShawn O. Pearce, Aug 12, 2008
  12. Nicolas PitreAug 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.