1. 30 6月, 2018 1 次提交
  2. 29 5月, 2018 1 次提交
  3. 24 5月, 2018 1 次提交
  4. 06 5月, 2018 1 次提交
    • J
      Replace all die("BUG: ...") calls by BUG() ones · 033abf97
      Johannes Schindelin 提交于
      In d8193743 (usage.c: add BUG() function, 2017-05-12), a new macro
      was introduced to use for reporting bugs instead of die(). It was then
      subsequently used to convert one single caller in 588a538a
      (setup_git_env: convert die("BUG") to BUG(), 2017-05-12).
      
      The cover letter of the patch series containing this patch
      (cf 20170513032414.mfrwabt4hovujde2@sigill.intra.peff.net) is not
      terribly clear why only one call site was converted, or what the plan
      is for other, similar calls to die() to report bugs.
      
      Let's just convert all remaining ones in one fell swoop.
      
      This trick was performed by this invocation:
      
      	sed -i 's/die("BUG: /BUG("/g' $(git grep -l 'die("BUG' \*.c)
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      033abf97
  5. 02 5月, 2018 1 次提交
  6. 11 4月, 2018 1 次提交
  7. 27 3月, 2018 1 次提交
  8. 15 3月, 2018 1 次提交
  9. 15 2月, 2018 1 次提交
  10. 13 2月, 2018 3 次提交
  11. 31 1月, 2018 1 次提交
  12. 17 1月, 2018 1 次提交
  13. 23 12月, 2017 1 次提交
  14. 08 12月, 2017 1 次提交
  15. 13 11月, 2017 1 次提交
  16. 06 11月, 2017 1 次提交
  17. 01 11月, 2017 3 次提交
    • B
      diff: make struct diff_flags members lowercase · 0d1e0e78
      Brandon Williams 提交于
      Now that the flags stored in struct diff_flags are being accessed
      directly and not through macros, change all struct members from being
      uppercase to lowercase.
      This conversion is done using the following semantic patch:
      
      	@@
      	expression E;
      	@@
      	- E.RECURSIVE
      	+ E.recursive
      
      	@@
      	expression E;
      	@@
      	- E.TREE_IN_RECURSIVE
      	+ E.tree_in_recursive
      
      	@@
      	expression E;
      	@@
      	- E.BINARY
      	+ E.binary
      
      	@@
      	expression E;
      	@@
      	- E.TEXT
      	+ E.text
      
      	@@
      	expression E;
      	@@
      	- E.FULL_INDEX
      	+ E.full_index
      
      	@@
      	expression E;
      	@@
      	- E.SILENT_ON_REMOVE
      	+ E.silent_on_remove
      
      	@@
      	expression E;
      	@@
      	- E.FIND_COPIES_HARDER
      	+ E.find_copies_harder
      
      	@@
      	expression E;
      	@@
      	- E.FOLLOW_RENAMES
      	+ E.follow_renames
      
      	@@
      	expression E;
      	@@
      	- E.RENAME_EMPTY
      	+ E.rename_empty
      
      	@@
      	expression E;
      	@@
      	- E.HAS_CHANGES
      	+ E.has_changes
      
      	@@
      	expression E;
      	@@
      	- E.QUICK
      	+ E.quick
      
      	@@
      	expression E;
      	@@
      	- E.NO_INDEX
      	+ E.no_index
      
      	@@
      	expression E;
      	@@
      	- E.ALLOW_EXTERNAL
      	+ E.allow_external
      
      	@@
      	expression E;
      	@@
      	- E.EXIT_WITH_STATUS
      	+ E.exit_with_status
      
      	@@
      	expression E;
      	@@
      	- E.REVERSE_DIFF
      	+ E.reverse_diff
      
      	@@
      	expression E;
      	@@
      	- E.CHECK_FAILED
      	+ E.check_failed
      
      	@@
      	expression E;
      	@@
      	- E.RELATIVE_NAME
      	+ E.relative_name
      
      	@@
      	expression E;
      	@@
      	- E.IGNORE_SUBMODULES
      	+ E.ignore_submodules
      
      	@@
      	expression E;
      	@@
      	- E.DIRSTAT_CUMULATIVE
      	+ E.dirstat_cumulative
      
      	@@
      	expression E;
      	@@
      	- E.DIRSTAT_BY_FILE
      	+ E.dirstat_by_file
      
      	@@
      	expression E;
      	@@
      	- E.ALLOW_TEXTCONV
      	+ E.allow_textconv
      
      	@@
      	expression E;
      	@@
      	- E.TEXTCONV_SET_VIA_CMDLINE
      	+ E.textconv_set_via_cmdline
      
      	@@
      	expression E;
      	@@
      	- E.DIFF_FROM_CONTENTS
      	+ E.diff_from_contents
      
      	@@
      	expression E;
      	@@
      	- E.DIRTY_SUBMODULES
      	+ E.dirty_submodules
      
      	@@
      	expression E;
      	@@
      	- E.IGNORE_UNTRACKED_IN_SUBMODULES
      	+ E.ignore_untracked_in_submodules
      
      	@@
      	expression E;
      	@@
      	- E.IGNORE_DIRTY_SUBMODULES
      	+ E.ignore_dirty_submodules
      
      	@@
      	expression E;
      	@@
      	- E.OVERRIDE_SUBMODULE_CONFIG
      	+ E.override_submodule_config
      
      	@@
      	expression E;
      	@@
      	- E.DIRSTAT_BY_LINE
      	+ E.dirstat_by_line
      
      	@@
      	expression E;
      	@@
      	- E.FUNCCONTEXT
      	+ E.funccontext
      
      	@@
      	expression E;
      	@@
      	- E.PICKAXE_IGNORE_CASE
      	+ E.pickaxe_ignore_case
      
      	@@
      	expression E;
      	@@
      	- E.DEFAULT_FOLLOW_RENAMES
      	+ E.default_follow_renames
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0d1e0e78
    • B
      diff: remove DIFF_OPT_SET macro · 23dcf77f
      Brandon Williams 提交于
      Remove the `DIFF_OPT_SET` macro and instead set the flags directly.
      This conversion is done using the following semantic patch:
      
      	@@
      	expression E;
      	identifier fld;
      	@@
      	- DIFF_OPT_SET(&E, fld)
      	+ E.flags.fld = 1
      
      	@@
      	type T;
      	T *ptr;
      	identifier fld;
      	@@
      	- DIFF_OPT_SET(ptr, fld)
      	+ ptr->flags.fld = 1
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      23dcf77f
    • B
      diff: remove DIFF_OPT_TST macro · 3b69daed
      Brandon Williams 提交于
      Remove the `DIFF_OPT_TST` macro and instead access the flags directly.
      This conversion is done using the following semantic patch:
      
      	@@
      	expression E;
      	identifier fld;
      	@@
      	- DIFF_OPT_TST(&E, fld)
      	+ E.flags.fld
      
      	@@
      	type T;
      	T *ptr;
      	identifier fld;
      	@@
      	- DIFF_OPT_TST(ptr, fld)
      	+ ptr->flags.fld
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3b69daed
  18. 16 10月, 2017 2 次提交
  19. 06 10月, 2017 2 次提交
    • M
      apply: move lockfile into `apply_state` · 6d058c88
      Martin Ågren 提交于
      We have two users of `struct apply_state` and the related functionality
      in apply.c. Each user sets up its `apply_state` by handing over a
      pointer to its static `lock_file`. (Before 076aa2cb (tempfile:
      auto-allocate tempfiles on heap, 2017-09-05), we could never free
      lockfiles, so making them static was a reasonable approach.)
      
      Other than that, they never directly access their `lock_file`s, which
      are instead handled by the functionality in apply.c.
      
      To make life easier for the caller and to make it less tempting for a
      future caller to mess with the lock, make apply.c fully responsible for
      setting up the `lock_file`. As mentioned above, it is now safe to free a
      `lock_file`, so we can make the `struct apply_state` contain an actual
      `struct lock_file` instead of a pointer to one.
      
      The user in builtin/apply.c is rather simple. For builtin/am.c, we might
      worry that the lock state is actually meant to be inherited across
      calls. But the lock is only taken as `apply_all_patches()` executes, and
      code inspection shows that it will always be released.
      
      Alternatively, we can observe that the lock itself is never queried
      directly. When we decide whether we should lock, we check a related
      variable `newfd`. That variable is not inherited, so from the point of
      view of apply.c, the state machine really is reset with each call to
      `init_apply_state()`. (It would be a bug if `newfd` and the lock status
      were not in sync. The duplication of information in `newfd` and the lock
      will be addressed in the next patch.)
      Signed-off-by: NMartin Ågren <martin.agren@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6d058c88
    • M
      treewide: prefer lockfiles on the stack · 837e34eb
      Martin Ågren 提交于
      There is no longer any need to allocate and leak a `struct lock_file`.
      The previous patch addressed an instance where we needed a minor tweak
      alongside the trivial changes.
      
      Deal with the remaining instances where we allocate and leak a struct
      within a single function. Change them to have the `struct lock_file` on
      the stack instead.
      
      These instances were identified by running `git grep "^\s*struct
      lock_file\s*\*"`.
      Signed-off-by: NMartin Ågren <martin.agren@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      837e34eb
  20. 07 9月, 2017 3 次提交
  21. 24 8月, 2017 1 次提交
  22. 09 8月, 2017 1 次提交
  23. 03 8月, 2017 1 次提交
  24. 18 7月, 2017 1 次提交
    • B
      sha1_name: convert get_sha1* to get_oid* · e82caf38
      brian m. carlson 提交于
      Now that all the callers of get_sha1 directly or indirectly use struct
      object_id, rename the functions starting with get_sha1 to start with
      get_oid.  Convert the internals in sha1_name.c to use struct object_id
      as well, and eliminate explicit length checks where possible.  Convert a
      use of 40 in get_oid_basic to GIT_SHA1_HEXSZ.
      
      Outside of sha1_name.c and cache.h, this transition was made with the
      following semantic patch:
      
      @@
      expression E1, E2;
      @@
      - get_sha1(E1, E2.hash)
      + get_oid(E1, &E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1(E1, E2->hash)
      + get_oid(E1, E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_committish(E1, E2.hash)
      + get_oid_committish(E1, &E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_committish(E1, E2->hash)
      + get_oid_committish(E1, E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_treeish(E1, E2.hash)
      + get_oid_treeish(E1, &E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_treeish(E1, E2->hash)
      + get_oid_treeish(E1, E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_commit(E1, E2.hash)
      + get_oid_commit(E1, &E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_commit(E1, E2->hash)
      + get_oid_commit(E1, E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_tree(E1, E2.hash)
      + get_oid_tree(E1, &E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_tree(E1, E2->hash)
      + get_oid_tree(E1, E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_blob(E1, E2.hash)
      + get_oid_blob(E1, &E2)
      
      @@
      expression E1, E2;
      @@
      - get_sha1_blob(E1, E2->hash)
      + get_oid_blob(E1, E2)
      
      @@
      expression E1, E2, E3, E4;
      @@
      - get_sha1_with_context(E1, E2, E3.hash, E4)
      + get_oid_with_context(E1, E2, &E3, E4)
      
      @@
      expression E1, E2, E3, E4;
      @@
      - get_sha1_with_context(E1, E2, E3->hash, E4)
      + get_oid_with_context(E1, E2, E3, E4)
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e82caf38
  25. 17 6月, 2017 2 次提交
  26. 16 6月, 2017 1 次提交
  27. 02 6月, 2017 1 次提交
  28. 30 5月, 2017 1 次提交
    • J
      am: handle "-h" argument earlier · f3a2fffe
      Jeff King 提交于
      If the user provides "-h" on the command line, then our
      parse_options() invocation will show a usage message and
      quit. But if "-h" is the only argument, the git wrapper
      behaves specially: it ignores our RUN_SETUP flag and calls
      cmd_am() without having done repository setup at all.  This
      is due to 99caeed0 (Let 'git <command> -h' show usage
      without a git dir, 2009-11-09).
      
      Before cmd_am() calls parse_options(), though, it runs a few
      other setup functions. One of these is am_state_init(),
      which uses git_pathdup() to set up the default rebase-apply
      path. But calling git_pathdup() when we haven't done
      repository setup will fall back to using ".git". That's
      mostly harmless (since we won't use the value anyway), but
      is forbidden since b1ef400e ("setup_git_env: avoid blind
      fall-back to ".git"", 2016-10-20), and we now BUG().
      
      We can't easily move that setup to after the parse_options()
      call; the point is to set up defaults that are overwritten
      by the option parsing. Instead, we'll detect the "-h" case
      early and show the usage then. This matches the behavior of
      other builtins which have a similar setup-ordering issue
      (e.g., git-branch).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f3a2fffe
  29. 26 5月, 2017 1 次提交
    • N
      use xfopen() in more places · 23a9e071
      Nguyễn Thái Ngọc Duy 提交于
      xfopen()
      
       - provides error details
       - explains error on reading, or writing, or whatever operation
       - has l10n support
       - prints file name in the error
      
      Some of these are missing in the places that are replaced with xfopen(),
      which is a clear win. In some other places, it's just less code (not as
      clearly a win as the previous case but still is).
      
      The only slight regresssion is in remote-testsvn, where we don't report
      the file class (marks files) in the error messages anymore. But since
      this is a _test_ svn remote transport, I'm not too concerned.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      23a9e071
  30. 12 5月, 2017 1 次提交
    • J
      usability: don't ask questions if no reply is required · 6c486862
      Jean-Noel Avila 提交于
      There has been a bug report by a corporate user that stated that
      "spelling mistake of stash followed by a yes prints character 'y'
      infinite times."
      
      This analysis was false. When the spelling of a command contains
      errors, the git program tries to help the user by providing candidates
      which are close to the unexisting command. E.g Git prints the
      following:
      
              git: 'stahs' is not a git command. See 'git --help'.
              Did you mean this?
      
              stash
      
      and then exits.
      
      The problem with this hint is that it is not formally indicated as an
      hint and the user is in fact encouraged to reply to the question,
      whereas the Git command is already finished.
      
      The user was unlucky enough that it was the command he was looking
      for, and replied "yes" on the command line, effectively launching the
      `yes` program.
      
      The initial error is that the Git programs, when launched in
      command-line mode (without interaction) must not ask questions,
      because these questions would normally require a user input as a reply
      that they won't handle indeed. That's a source of confusion on UX
      level.
      
      To improve the general usability of the Git suite, the following rule
      was applied:
      
      if the sentence
       * appears in a non-interactive session
       * is printed last before exit
       * is a question addressing the user ("you")
      
      the sentence is turned into affirmative and proposes the option.
      
      The basic rewording of the question sentences has been extended to
      other spots found in the source.
      
      Requested at https://github.com/git/git-scm.com/issues/999 by rpai1
      Signed-off-by: NJean-Noel Avila <jn.avila@free.fr>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6c486862
  31. 08 5月, 2017 1 次提交