Commit graph

7 commits

Author SHA1 Message Date
Rubén Justo 71c7916053 apply: plug a leak in apply_data
We have an execution path in apply_data that leaks the local struct
image.  Plug it.

This leak can be triggered with:

    $ echo foo >file
    $ git add file && git commit -m file
    $ echo bar >file
    $ git diff file >diff
    $ sed s/foo/frotz/ <diff >baddiff
    $ git apply --cached <baddiff

Fixing this leak allows us to mark as leak-free the following tests:

    + t2016-checkout-patch.sh
    + t4103-apply-binary.sh
    + t4104-apply-boundary.sh
    + t4113-apply-ending.sh
    + t4117-apply-reject.sh
    + t4123-apply-shrink.sh
    + t4252-am-options.sh
    + t4258-am-quoted-cr.sh

Mark them with "TEST_PASSES_SANITIZE_LEAK=true" to notice and fix
promply any new leak that may be introduced and triggered by them in the
future.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-04-22 16:27:42 -07:00
Jonathan Nieder a48fcd8369 tests: add missing &&
Breaks in a test assertion's && chain can potentially hide
failures from earlier commands in the chain.

Commands intended to fail should be marked with !, test_must_fail, or
test_might_fail.  The examples in this patch do not require that.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09 11:59:49 -08:00
martin f. krafft b80da424a1 git-am: implement --reject option passed to git-apply
With --reject, git-am simply passes the --reject option to git-apply and thus
allows people to work with reject files if they so prefer.

Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-23 17:00:12 -08:00
Junio C Hamano 17f26a9ee3 git-am: fix shell quoting
Noticed by Stephan Beyer; the new test is mine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-14 16:29:59 -08:00
Junio C Hamano b47dfe9e9c git-am: add --directory=<dir> option
Thanks to a200337 (git-am: propagate -C<n>, -p<n> options as well,
2008-12-04) and commits around it, "git am" is equipped to correctly
propagate the command line flags such as -C/-p/-whitespace across a patch
failure and restart.

It is trivial to support --directory option now, resurrecting previous
attempts by Kevin and Simon.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-12 02:26:01 -08:00
Junio C Hamano 9b9f5a2258 git-am: rename apply_opt_extra file to apply-opt
All other state files use dash in their names, not underscores.
Also, there is no reason to call this "extra".  Drop it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-05 20:02:10 -08:00
Junio C Hamano fe6beab7e8 Test that git-am does not lose -C/-p/--whitespace options
These tests make sure that "git am" does not lose command line options
specified when it was started, after it is interrupted by a patch that
does not apply earlier in the series.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-04 18:45:02 -08:00