Skip to content
Permalink
Branch: master
Commits on Jan 2, 2019
  1. bisect--helper: `bisect_start` shell function partially in C

    pranitbauva1997 authored and gitster committed Jan 2, 2019
    Reimplement the `bisect_start` shell function partially in C and add
    `bisect-start` subcommand to `git bisect--helper` to call it from
    git-bisect.sh .
    
    The last part is not converted because it calls another shell function.
    `bisect_start` shell function will be completed after the `bisect_next`
    shell function is ported in C.
    
    Using `--bisect-start` subcommand is a temporary measure to port shell
    function in C so as to use the existing test suite. As more functions
    are ported, this subcommand will be retired and will be called by some
    other methods.
    
    Also introduce a method `bisect_append_log_quoted` to keep things short
    and crisp.
    
    Note that we are a bit lax about command-line parsing because the helper
    is not supposed to be called by the user directly (but only from the git
    bisect script).
    
    Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
    Helped-by: Stephan Beyer <s-beyer@gmx.net>
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. bisect--helper: `get_terms` & `bisect_terms` shell function in C

    pranitbauva1997 authored and gitster committed Jan 2, 2019
    Reimplement the `get_terms` and `bisect_terms` shell function in C and
    add `bisect-terms` subcommand to `git bisect--helper` to call it from
    git-bisect.sh .
    
    Using `--bisect-terms` subcommand is a temporary measure to port shell
    function in C so as to use the existing test suite. As more functions
    are ported, this subcommand will be retired but its implementation will
    be called by some other methods.
    
    Also use error() to report "no terms defined" and accordingly change the
    test in t6030.
    
    We need to use PARSE_OPT_KEEP_UNKNOWN here to allow for parameters that
    look like options (e.g --term-good) but should not be parsed by
    cmd_bisect__helper(). This change is safe because all other cmdmodes have
    strict argc checks already.
    
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. bisect--helper: `bisect_next_check` shell function in C

    pranitbauva1997 authored and gitster committed Jan 2, 2019
    Reimplement `bisect_next_check` shell function in C and add
    `bisect-next-check` subcommand to `git bisect--helper` to call it from
    git-bisect.sh .
    
    `bisect_voc` shell function is no longer useful now and is replaced by
    using a char *[] of "new|bad" and "good|old" values.
    
    Using `--bisect-next-check` is a temporary measure to port shell
    function to C so as to use the existing test suite. As more functions
    are ported, this subcommand will be retired but its implementation will
    be called by some other methods.
    
    Helped-by: Stephan Beyer <s-beyer@gmx.net>
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. bisect--helper: `check_and_set_terms` shell function in C

    pranitbauva1997 authored and gitster committed Jan 2, 2019
    Reimplement the `check_and_set_terms` shell function in C and add
    `check-and-set-terms` subcommand to `git bisect--helper` to call it from
    git-bisect.sh
    
    Using `--check-and-set-terms` subcommand is a temporary measure to port
    shell function in C so as to use the existing test suite. As more
    functions are ported, this subcommand will be retired but its
    implementation will be called by some other methods.
    
    check_and_set_terms() sets and receives two global variables namely
    TERM_GOOD and TERM_BAD in the shell script. Luckily the file BISECT_TERMS
    also contains the value of those variables so its appropriate to evoke the
    method get_terms() after calling the subcommand so that it retrieves the
    value of TERM_GOOD and TERM_BAD from the file BISECT_TERMS. The two
    global variables are passed as arguments to the subcommand.
    
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. wrapper: move is_empty_file() and rename it as is_empty_or_missing_fi…

    pranitbauva1997 authored and gitster committed Jan 2, 2019
    …le()
    
    is_empty_file() can help to refactor a lot of code. This will be very
    helpful in porting "git bisect" to C.
    
    Suggested-by: Torsten Bögershausen <tboegi@web.de>
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. bisect--helper: `bisect_write` shell function in C

    pranitbauva1997 authored and gitster committed Jan 2, 2019
    Reimplement the `bisect_write` shell function in C and add a
    `bisect-write` subcommand to `git bisect--helper` to call it from
    git-bisect.sh
    
    Using `--bisect-write` subcommand is a temporary measure to port shell
    function in C so as to use the existing test suite. As more functions
    are ported, this subcommand will be retired but its implementation will
    be called by some other methods.
    
    Note: bisect_write() uses two variables namely TERM_GOOD and TERM_BAD
    from the global shell script thus we need to pass it to the subcommand
    using the arguments. We then store them in a struct bisect_terms and
    pass the memory address around functions.
    
    Add a log_commit() helper function to write the contents of the commit message
    header to a file which will be re-used in future parts of the code as
    well.
    
    Also introduce a function free_terms() to free the memory of `struct
    bisect_terms` and set_terms() to set the values of members in `struct
    bisect_terms`.
    
    Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  7. bisect--helper: `bisect_reset` shell function in C

    pranitbauva1997 authored and gitster committed Jan 2, 2019
    Reimplement `bisect_reset` shell function in C and add a `--bisect-reset`
    subcommand to `git bisect--helper` to call it from git-bisect.sh .
    
    Using `bisect_reset` subcommand is a temporary measure to port shell
    functions to C so as to use the existing test suite. As more functions
    are ported, this subcommand would be retired but its implementation will
    be called by some other method.
    
    Note: --bisect-clean-state subcommand has not been retired as there are
    still a function namely `bisect_start()` which still uses this
    subcommand.
    
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Mentored by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 6, 2017
  1. bisect--helper: `is_expected_rev` & `check_expected_revs` shell funct…

    pranitbauva1997 authored and gitster committed Sep 29, 2017
    …ion in C
    
    Reimplement `is_expected_rev` & `check_expected_revs` shell function in
    C and add a `--check-expected-revs` subcommand to `git bisect--helper` to
    call it from git-bisect.sh .
    
    Using `--check-expected-revs` subcommand is a temporary measure to port
    shell functions to C so as to use the existing test suite. As more
    functions are ported, this subcommand would be retired but its
    implementation will be called by some other method.
    
    Helped-by: Eric Sunshine <sunshine@sunshineco.com>
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. t6030: explicitly test for bisection cleanup

    pranitbauva1997 authored and gitster committed Sep 29, 2017
    Add test to explicitly check that 'git bisect reset' is working as
    expected. This is already covered implicitly by the test suite.
    
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. bisect--helper: `bisect_clean_state` shell function in C

    pranitbauva1997 authored and gitster committed Sep 29, 2017
    Reimplement `bisect_clean_state` shell function in C and add a
    `bisect-clean-state` subcommand to `git bisect--helper` to call it from
    git-bisect.sh .
    
    Using `--bisect-clean-state` subcommand is a measure to port shell
    function to C so as to use the existing test suite. As more functions
    are ported, this subcommand will be retired but its implementation  will
    be called by bisect_reset() and bisect_start().
    
    Also introduce a function `mark_for_removal` to store the refs which
    need to be removed while iterating through the refs.
    
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. bisect--helper: `write_terms` shell function in C

    pranitbauva1997 authored and gitster committed Sep 29, 2017
    Reimplement the `write_terms` shell function in C and add a `write-terms`
    subcommand to `git bisect--helper` to call it from git-bisect.sh . Also
    remove the subcommand `--check-term-format` as it can now be called from
    inside the function write_terms() C implementation.
    
    Also `|| exit` is added when calling write-terms subcommand from
    git-bisect.sh so as to exit whenever there is an error.
    
    Using `--write-terms` subcommand is a temporary measure to port shell
    function to C so as to use the existing test suite. As more functions
    are ported, this subcommand will be retired and its implementation will
    be called by some other method.
    
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. bisect--helper: rewrite `check_term_format` shell function in C

    pranitbauva1997 authored and gitster committed Sep 29, 2017
    Reimplement the `check_term_format` shell function in C and add
    a `--check-term-format` subcommand to `git bisect--helper` to call it
    from git-bisect.sh
    
    Using `--check-term-format` subcommand is a temporary measure to port
    shell function to C so as to use the existing test suite. As more
    functions are ported, this subcommand will be retired and its
    implementation will be called by some other method/subcommand. For
    eg. In conversion of write_terms() of git-bisect.sh, the subcommand will
    be removed and instead check_term_format() will be called in its C
    implementation while a new subcommand will be introduced for write_terms().
    
    Helped-by: Johannes Schindelein <Johannes.Schindelein@gmx.de>
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. bisect--helper: use OPT_CMDMODE instead of OPT_BOOL

    pranitbauva1997 authored and gitster committed Sep 29, 2017
    `--next-all` is meant to be used as a subcommand to support multiple
    "operation mode" though the current implementation does not contain any
    other subcommand along side with `--next-all` but further commits will
    include some more subcommands.
    
    Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 9, 2017
  1. t9813: avoid using pipes

    pranitbauva1997 authored and gitster committed Jan 3, 2017
    The exit code of the upstream in a pipe is ignored thus we should avoid
    using it. By writing out the output of the git command to a file, we can
    test the exit codes of both the commands.
    
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Acked-by: Luke Diamand <luke@diamand.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 7, 2017
  1. don't use test_must_fail with grep

    pranitbauva1997 authored and gitster committed Jan 3, 2017
    test_must_fail should only be used for testing git commands. To test the
    failure of other commands use `!`.
    
    Reported-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 17, 2016
  1. t0040: convert all possible tests to use `test-parse-options --expect`

    pranitbauva1997 authored and gitster committed Oct 15, 2016
    Use "test-parse-options --expect" to rewrite the tests to avoid checking
    the whole variable dump by just testing what is required.
    
    This commit is a follow-up to 8ca65ae ("t0040: convert a few
    tests to use test-parse-options --expect", 2016-05-06).
    
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 27, 2016
  1. rev-list-options: clarify the usage of --reverse

    pranitbauva1997 authored and gitster committed Sep 27, 2016
    Users often wonder if the oldest or the newest n commits are shown
    by `log -n --reverse`.  Clarify that --reverse kicks in only after
    deciding which commits are to be shown to unconfuse them.
    
    Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 14, 2016
  1. strbuf: describe the return value of strbuf_read_file

    pranitbauva1997 authored and gitster committed Jun 14, 2016
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 9, 2016
  1. builtin/commit.c: memoize git-path for COMMIT_EDITMSG

    pranitbauva1997 authored and gitster committed May 24, 2016
    This is a follow up commit for f932729 (memoize common git-path
    "constant" files, 10-Aug-2015).
    
    The many function calls to git_path() are replaced by
    git_path_commit_editmsg() and which thus eliminates the need to repeatedly
    compute the location of "COMMIT_EDITMSG".
    
    Mentored-by: Lars Schneider <larsxschneider@gmail.com>
    Mentored-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Reviewed-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 10, 2016
  1. commit: add a commit.verbose config variable

    pranitbauva1997 authored and gitster committed May 5, 2016
    Add commit.verbose configuration variable as a convenience for those
    who always prefer --verbose.
    
    Add tests to check the behavior introduced by this commit and also to
    verify that behavior of status doesn't break because of this commit.
    
    Helped-by: Junio C Hamano <gitster@pobox.com>
    Helped-by: Eric Sunshine <sunshine@sunshineco.com>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 5, 2016
  1. t7507-commit-verbose: improve test coverage by testing number of diffs

    pranitbauva1997 authored and gitster committed May 5, 2016
    Make the fake "editor" store output of grep in a file so that we can
    see how many diffs were contained in the message and use them in
    individual tests where ever it is required. A subsequent commit will
    introduce scenarios where it is important to be able to exactly
    determine how many diffs were present.
    
    The fake "editor" is always made to succeed regardless of whether grep
    found diff headers or not so that we don't have to use 'test_must_fail'
    for which 'test_line_count = 0' is an easy substitute and also helps in
    maintaining the consistency.
    
    Also use write_script() to create the fake "editor".
    
    Helped-by: Eric Sunshine <sunshine@sunshineco.com>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. parse-options.c: make OPTION_COUNTUP respect "unspecified" values

    pranitbauva1997 authored and gitster committed May 5, 2016
    OPT_COUNTUP() merely increments the counter upon --option, and resets it
    to 0 upon --no-option, which means that there is no "unspecified" value
    with which a client can initialize the counter to determine whether or
    not --[no]-option was seen at all.
    
    Make OPT_COUNTUP() treat any negative number as an "unspecified" value
    to address this shortcoming. In particular, if a client initializes the
    counter to -1, then if it is still -1 after parse_options(), then
    neither --option nor --no-option was seen; if it is 0, then --no-option
    was seen last, and if it is 1 or greater, than --option was seen last.
    
    This change does not affect the behavior of existing clients because
    they all use the initial value of 0 (or more).
    
    Note that builtin/clean.c initializes the variable used with
    OPT__FORCE (which uses OPT_COUNTUP()) to a negative value, but it is set
    to either 0 or 1 by reading the configuration before the code calls
    parse_options(), i.e. as far as parse_options() is concerned, the
    initial value of the variable is not negative.
    
    To test this behavior, in test-parse-options.c, "verbose" is set to
    "unspecified" while quiet is set to 0 which will test the new behavior
    with all sets of values.
    
    Helped-by: Jeff King <peff@peff.net>
    Helped-by: Eric Sunshine <sunshine@sunshineco.com>
    Helped-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. t/t7507: improve test coverage

    pranitbauva1997 authored and gitster committed May 5, 2016
    git-commit and git-status share the same implementation thus it is
    necessary to ensure that changes specific to git-commit don't
    accidentally impact git-status.
    
    This test verifies that changes made to verbose in git-commit does not
    impact git-status.
    
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. t0040-parse-options: improve test coverage

    pranitbauva1997 authored and gitster committed May 5, 2016
    Include tests to check for multiple levels of quiet and to check the
    behavior of '--no-quiet'.
    
    Include tests to check for multiple levels of verbose and to check the
    behavior of '--no-verbose'.
    
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 19, 2016
  1. test-parse-options: print quiet as integer

    pranitbauva1997 authored and gitster committed Apr 12, 2016
    We would want to see how multiple --quiet options affect the value of
    the underlying variable (we may want "--quiet --quiet" to still be 1, or
    we may want to see the value incremented to 2). Show the value as
    integer to allow us to inspect it.
    
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. t0040-test-parse-options.sh: fix style issues

    pranitbauva1997 authored and gitster committed Apr 12, 2016
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 25, 2016
  1. api-parse-options.txt: document OPT_CMDMODE()

    pranitbauva1997 authored and gitster committed Mar 25, 2016
    OPT_CMDMODE mechanism was introduced in the release of 1.8.5 to actively
    notice when multiple "operation mode" options that specify mutually
    incompatible operation modes are given.
    
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 11, 2016
  1. t/t7502 : drop duplicate test

    pranitbauva1997 authored and gitster committed Mar 11, 2016
    This extra test was introduced erroneously by
    f9c0181 (t7502: test commit.status, --status and
    --no-status, 2010-01-13)
    
    Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
You can’t perform that action at this time.