Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- git svn: fix authentication with 'branch'
- Authentication fails with svn branch while svn rebase and
- svn dcommit work fine without authentication failures.
- $ git svn branch v7_3
- Copying https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx at r27519
- to https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/v7_3...
- Can't create session: Unable to connect to a repository at URL
- 'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': No more
- credentials or we tried too many times.
- Authentication failed at
- C:\Program Files\Git\mingw64/libexec/git-core\git-svn line 1200.
- We add auth configuration to SVN::Client->new() to fix the issue.
- Signed-off-by: Hiroshi Shirosaki <h.shirosaki@gmail.com>
- Signed-off-by: Eric Wong <e@80x24.org>
- First batch after 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'rl/remote-allow-missing-branch-name-merge'
- "git remote rm X", when a branch has remote X configured as the
- value of its branch.*.remote, tried to remove branch.*.remote and
- branch.*.merge and failed if either is unset.
- * rl/remote-allow-missing-branch-name-merge:
- remote: ignore failure to remove missing branch.<name>.merge
- Merge branch 'km/delete-ref-reflog-message'
- "git update-ref -d" and other operations to delete references did
- not leave any entry in HEAD's reflog when the reference being
- deleted was the current branch. This is not a problem in practice
- because you do not want to delete the branch you are currently on,
- but caused renaming of the current branch to something else not to
- be logged in a useful way.
- * km/delete-ref-reflog-message:
- branch: record creation of renamed branch in HEAD's log
- rename_ref: replace empty message in HEAD's log
- update-ref: pass reflog message to delete_ref()
- delete_ref: accept a reflog message argument
- Merge branch 'jk/tempfile-ferror-fclose-confusion'
- A caller of tempfile API that uses stdio interface to write to
- files may ignore errors while writing, which is detected when
- tempfile is closed (with a call to ferror()). By that time, the
- original errno that may have told us what went wrong is likely to
- be long gone and was overwritten by an irrelevant value.
- close_tempfile() now resets errno to EIO to make errno at least
- predictable.
- * jk/tempfile-ferror-fclose-confusion:
- tempfile: set errno to a known value before calling ferror()
- Merge branch 'vn/xdiff-func-context'
- "git diff -W" has been taught to handle the case where a new
- function is added at the end of the file better.
- * vn/xdiff-func-context:
- xdiff -W: relax end-of-file function detection
- Merge branch 'js/git-path-in-subdir'
- The "--git-path", "--git-common-dir", and "--shared-index-path"
- options of "git rev-parse" did not produce usable output. They are
- now updated to show the path to the correct file, relative to where
- the caller is.
- * js/git-path-in-subdir:
- rev-parse: fix several options when running in a subdirectory
- rev-parse tests: add tests executed from a subdirectory
- Merge branch 'mm/two-more-xstrfmt'
- Code clean-up and a string truncation fix.
- * mm/two-more-xstrfmt:
- bisect_next_all: convert xsnprintf to xstrfmt
- stop_progress_msg: convert xsnprintf to xstrfmt
- Merge branch 'nd/clean-preserve-errno-in-warning'
- Some warning() messages from "git clean" were updated to show the
- errno from failed system calls.
- * nd/clean-preserve-errno-in-warning:
- clean: use warning_errno() when appropriate
- Merge branch 'jk/show-branch-lift-name-len-limit'
- "git show-branch" expected there were only very short branch names
- in the repository and used a fixed-length buffer to hold them
- without checking for overflow.
- * jk/show-branch-lift-name-len-limit:
- show-branch: use skip_prefix to drop magic numbers
- show-branch: store resolved head in heap buffer
- show-branch: drop head_len variable
- Merge branch 'jn/remote-helpers-with-git-dir'
- "git ls-remote" and "git archive --remote" are designed to work
- without being in a directory under Git's control. However, recent
- updates revealed that we randomly look into a directory called
- .git/ without actually doing necessary set-up when working in a
- repository. Stop doing so.
- * jn/remote-helpers-with-git-dir:
- remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
- remote: avoid reading $GIT_DIR config in non-repo
- Merge branch 'jk/grep-no-index-fix'
- The code to parse the command line "git grep <patterns>... <rev>
- [[--] <pathspec>...]" has been cleaned up, and a handful of bugs
- have been fixed (e.g. we used to check "--" if it is a rev).
- * jk/grep-no-index-fix:
- grep: treat revs the same for --untracked as for --no-index
- grep: do not diagnose misspelt revs with --no-index
- grep: avoid resolving revision names in --no-index case
- grep: fix "--" rev/pathspec disambiguation
- grep: re-order rev-parsing loop
- grep: do not unnecessarily query repo for "--"
- grep: move thread initialization a little lower
- Merge branch 'dt/gc-ignore-old-gc-logs'
- A "gc.log" file left by a backgrounded "gc --auto" disables further
- automatic gc; it has been taught to run at least once a day (by
- default) by ignoring a stale "gc.log" file that is too old.
- * dt/gc-ignore-old-gc-logs:
- gc: ignore old gc.log files
- Merge branch 'jh/preload-index-skip-skip'
- The preload-index code has been taught not to bother with the index
- entries that are paths that are not checked out by "sparse checkout".
- * jh/preload-index-skip-skip:
- preload-index: avoid lstat for skip-worktree items
- Merge branch 'mh/submodule-hash'
- Code and design clean-up for the refs API.
- * mh/submodule-hash:
- read_loose_refs(): read refs using resolve_ref_recursively()
- files_ref_store::submodule: use NULL for the main repository
- base_ref_store_init(): remove submodule argument
- refs: push the submodule attribute down
- refs: store submodule ref stores in a hashmap
- register_ref_store(): new function
- refs: remove some unnecessary handling of submodule == ""
- refs: make some ref_store lookup functions private
- refs: reorder some function definitions
- Merge branch 'sf/putty-w-args'
- The command line options for ssh invocation needs to be tweaked for
- some implementations of SSH (e.g. PuTTY plink wants "-P <port>"
- while OpenSSH wants "-p <port>" to specify port to connect to), and
- the variant was guessed when GIT_SSH environment variable is used
- to specify it. The logic to guess now applies to the command
- specified by the newer GIT_SSH_COMMAND and also core.sshcommand
- configuration variable, and comes with an escape hatch for users to
- deal with misdetected cases.
- * sf/putty-w-args:
- connect.c: stop conflating ssh command names and overrides
- connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config
- git_connect(): factor out SSH variant handling
- connect: rename tortoiseplink and putty variables
- connect: handle putty/plink also in GIT_SSH_COMMAND
- Merge branch 'js/rebase-helper'
- "git rebase -i" starts using the recently updated "sequencer" code.
- * js/rebase-helper:
- rebase -i: use the rebase--helper builtin
- rebase--helper: add a builtin helper for interactive rebases
- Merge branch 'bw/attr'
- The gitattributes machinery is being taught to work better in a
- multi-threaded environment.
- * bw/attr: (27 commits)
- attr: reformat git_attr_set_direction() function
- attr: push the bare repo check into read_attr()
- attr: store attribute stack in attr_check structure
- attr: tighten const correctness with git_attr and match_attr
- attr: remove maybe-real, maybe-macro from git_attr
- attr: eliminate global check_all_attr array
- attr: use hashmap for attribute dictionary
- attr: change validity check for attribute names to use positive logic
- attr: pass struct attr_check to collect_some_attrs
- attr: retire git_check_attrs() API
- attr: convert git_check_attrs() callers to use the new API
- attr: convert git_all_attrs() to use "struct attr_check"
- attr: (re)introduce git_check_attr() and struct attr_check
- attr: rename function and struct related to checking attributes
- attr.c: outline the future plans by heavily commenting
- Documentation: fix a typo
- attr.c: add push_stack() helper
- attr: support quoting pathname patterns in C style
- attr.c: plug small leak in parse_attr_line()
- attr.c: tighten constness around "git_attr" structure
- ...
- Merge branch 'sg/completion'
- Clean-up and updates to command line completion (in contrib/).
- * sg/completion: (22 commits)
- completion: restore removed line continuating backslash
- completion: cache the path to the repository
- completion: extract repository discovery from __gitdir()
- completion: don't guard git executions with __gitdir()
- completion: consolidate silencing errors from git commands
- completion: don't use __gitdir() for git commands
- completion: respect 'git -C <path>'
- rev-parse: add '--absolute-git-dir' option
- completion: fix completion after 'git -C <path>'
- completion: don't offer commands when 'git --opt' needs an argument
- completion: list short refs from a remote given as a URL
- completion: don't list 'HEAD' when trying refs completion outside of a repo
- completion: list refs from remote when remote's name matches a directory
- completion: respect 'git --git-dir=<path>' when listing remote refs
- completion: fix most spots not respecting 'git --git-dir=<path>'
- completion: ensure that the repository path given on the command line exists
- completion tests: add tests for the __git_refs() helper function
- completion tests: check __gitdir()'s output in the error cases
- completion tests: consolidate getting path of current working directory
- completion tests: make the $cur variable local to the test helper functions
- ...
- Merge branch 'lt/pathspec-negative'
- The "negative" pathspec feature was somewhat more cumbersome to use
- than necessary in that its short-hand used "!" which needed to be
- escaped from shells, and it required "exclude from what?" specified.
- * lt/pathspec-negative:
- pathspec: don't error out on all-exclusionary pathspec patterns
- pathspec magic: add '^' as alias for '!'
- Merge branch 'cw/tag-reflog-message'
- "git tag" did not leave useful message when adding a new entry to
- reflog; this was left unnoticed for a long time because refs/tags/*
- doesn't keep reflog by default.
- * cw/tag-reflog-message:
- tag: generate useful reflog message
- Merge branch 'jk/alternate-ref-optim'
- Optimizes resource usage while enumerating refs from alternate
- object store, to help receiving end of "push" that hosts a
- repository with many "forks".
- * jk/alternate-ref-optim:
- receive-pack: avoid duplicates between our refs and alternates
- receive-pack: treat namespace .have lines like alternates
- receive-pack: fix misleading namespace/.have comment
- receive-pack: use oidset to de-duplicate .have lines
- add oidset API
- fetch-pack: cache results of for_each_alternate_ref
- for_each_alternate_ref: replace transport code with for-each-ref
- for_each_alternate_ref: pass name/oid instead of ref struct
- for_each_alternate_ref: use strbuf for path allocation
- for_each_alternate_ref: stop trimming trailing slashes
- for_each_alternate_ref: handle failure from real_pathdup()
- Merge branch 'kn/ref-filter-branch-list'
- The code to list branches in "git branch" has been consolidated
- with the more generic ref-filter API.
- * kn/ref-filter-branch-list: (21 commits)
- ref-filter: resurrect "strip" as a synonym to "lstrip"
- branch: implement '--format' option
- branch: use ref-filter printing APIs
- branch, tag: use porcelain output
- ref-filter: allow porcelain to translate messages in the output
- ref-filter: add an 'rstrip=<N>' option to atoms which deal with refnames
- ref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'
- ref-filter: Do not abruptly die when using the 'lstrip=<N>' option
- ref-filter: rename the 'strip' option to 'lstrip'
- ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
- ref-filter: introduce refname_atom_parser()
- ref-filter: introduce refname_atom_parser_internal()
- ref-filter: make "%(symref)" atom work with the ':short' modifier
- ref-filter: add support for %(upstream:track,nobracket)
- ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
- ref-filter: introduce format_ref_array_item()
- ref-filter: move get_head_description() from branch.c
- ref-filter: modify "%(objectname:short)" to take length
- ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
- ref-filter: include reference to 'used_atom' within 'atom_value'
- ...
- Merge branch 'ps/urlmatch-wildcard'
- The <url> part in "http.<url>.<variable>" configuration variable
- can now be spelled with '*' that serves as wildcard.
- E.g. "http.https://*.example.com.proxy" can be used to specify the
- proxy used for https://a.example.com, https://b.example.com, etc.,
- i.e. any host in the example.com domain.
- * ps/urlmatch-wildcard:
- urlmatch: allow globbing for the URL host part
- urlmatch: include host in urlmatch ranking
- urlmatch: split host and port fields in `struct url_info`
- urlmatch: enable normalization of URLs with globs
- mailmap: add Patrick Steinhardt's work address
- Merge branch 'mm/merge-rename-delete-message'
- When "git merge" detects a path that is renamed in one history
- while the other history deleted (or modified) it, it now reports
- both paths to help the user understand what is going on in the two
- histories being merged.
- * mm/merge-rename-delete-message:
- merge-recursive: make "CONFLICT (rename/delete)" message show both paths
- Merge branch 'mh/ref-remove-empty-directory'
- Deletion of a branch "foo/bar" could remove .git/refs/heads/foo
- once there no longer is any other branch whose name begins with
- "foo/", but we didn't do so so far. Now we do.
- * mh/ref-remove-empty-directory: (23 commits)
- files_transaction_commit(): clean up empty directories
- try_remove_empty_parents(): teach to remove parents of reflogs, too
- try_remove_empty_parents(): don't trash argument contents
- try_remove_empty_parents(): rename parameter "name" -> "refname"
- delete_ref_loose(): inline function
- delete_ref_loose(): derive loose reference path from lock
- log_ref_write_1(): inline function
- log_ref_setup(): manage the name of the reflog file internally
- log_ref_write_1(): don't depend on logfile argument
- log_ref_setup(): pass the open file descriptor back to the caller
- log_ref_setup(): improve robustness against races
- log_ref_setup(): separate code for create vs non-create
- log_ref_write(): inline function
- rename_tmp_log(): improve error reporting
- rename_tmp_log(): use raceproof_create_file()
- lock_ref_sha1_basic(): use raceproof_create_file()
- lock_ref_sha1_basic(): inline constant
- raceproof_create_file(): new function
- safe_create_leading_directories(): set errno on SCLD_EXISTS
- safe_create_leading_directories_const(): preserve errno
- ...
- Merge branch 'jk/delta-chain-limit'
- "git repack --depth=<n>" for a long time busted the specified depth
- when reusing delta from existing packs. This has been corrected.
- * jk/delta-chain-limit:
- pack-objects: convert recursion to iteration in break_delta_chain()
- pack-objects: enforce --depth limit in reused deltas
- Merge branch 'jk/describe-omit-some-refs'
- "git describe" and "git name-rev" have been taught to take more
- than one refname patterns to restrict the set of refs to base their
- naming output on, and also learned to take negative patterns to
- name refs not to be used for naming via their "--exclude" option.
- * jk/describe-omit-some-refs:
- describe: teach describe negative pattern matches
- describe: teach --match to accept multiple patterns
- name-rev: add support to exclude refs by pattern match
- name-rev: extend --refs to accept multiple patterns
- doc: add documentation for OPT_STRING_LIST
- Git 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'ps/doc-gc-aggressive-depth-update'
- Doc update.
- * ps/doc-gc-aggressive-depth-update:
- docs/git-gc: fix default value for `--aggressiveDepth`
- Merge branch 'bc/worktree-doc-fix-detached'
- Doc update.
- * bc/worktree-doc-fix-detached:
- Documentation: correctly spell git worktree --detach
- Merge branch 'dr/doc-check-ref-format-normalize'
- Doc update.
- * dr/doc-check-ref-format-normalize:
- git-check-ref-format: clarify documentation for --normalize
- Merge branch 'gp/document-dotfiles-in-templates-are-not-copied'
- Doc update.
- * gp/document-dotfiles-in-templates-are-not-copied:
- init: document dotfiles exclusion on template copy
- Merge branch 'rt/align-add-i-help-text'
- Doc update.
- * rt/align-add-i-help-text:
- git add -i: replace \t with blanks in the help message
- Merge branch 'bc/blame-doc-fix'
- Doc update.
- * bc/blame-doc-fix:
- Documentation: use brackets for optional arguments
- docs/git-gc: fix default value for `--aggressiveDepth`
- In commit 07e7dbf0d (gc: default aggressive depth to 50, 2016-08-11),
- the default aggressive depth of git-gc has been changed to 50. While
- git-config(1) has been updated to represent the new default value,
- git-gc(1) still mentions the old value. This patch fixes it.
- Signed-off-by: Patrick Steinhardt <ps@pks.im>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge tag 'l10n-2.12.0-rnd2' of git://github.com/git-l10n/git-po
- l10n-2.12.0-rnd2
- * tag 'l10n-2.12.0-rnd2' of git://github.com/git-l10n/git-po: (22 commits)
- l10n: zh_CN: for git v2.12.0 l10n round 2
- l10n: Update Catalan translation
- l10n: pt_PT: update Portuguese tranlation
- l10n: sv.po: Update Swedish translation (3139t0f0u)
- l10n: de.po: translate 241 messages
- l10n: ko.po: Update Korean translation
- l10n: vi.po (3139t): Updated 2 new messages for rc1
- l10n: fr.po: v2.12.0 round 2 3139t
- l10n: git.pot: v2.12.0 round 2 (2 new)
- l10n: vi.po: Updated Vietnamese translation (3137t)
- l10n: update Catalan translation
- l10n: sv.po: Update Swedish translation (3137t0f0u)
- l10n: fr.po: v2.11-rc0 first round
- l10n: ko.po: Update Korean translation
- l10n: fr.po: Fix a typo in the French translation
- l10n: fr.po: Remove gender specific adjectives
- l10n: fr.po: Fix typos
- l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)
- l10n: bg: Updated Bulgarian translation (2913t+0f+0u)
- l10n: fixes to Catalan translation
- ...
- l10n: zh_CN: for git v2.12.0 l10n round 2
- Translate 241 messages (3139t0f0u) for git v2.12.0-rc1.
- Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
- l10n: Update Catalan translation
- Signed-off-by: Jordi Mas <jmas@softcatala.org>
- l10n: pt_PT: update Portuguese tranlation
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- git add -i: replace \t with blanks in the help message
- Within the help message of 'git add -i', the 'diff' command uses one
- tab character and blanks to create the space between the name and the
- description while the others use blanks only. So if the tab size is
- not at 4 characters, this description will not be in range.
- Replace the tab character with blanks.
- Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: use brackets for optional arguments
- The documentation for git blame used vertical bars for optional
- arguments to -M and -C, which is unusual and potentially confusing.
- Since most man pages use brackets for optional items, and that's
- consistent with how we document the same options for git diff and
- friends, use brackets here, too.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: correctly spell git worktree --detach
- The option is “--detach”, but we accidentally spelled it “--detached” at
- one point in the man page.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Reported-by: Casey Rodarmor <casey@rodarmor.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- remote: ignore failure to remove missing branch.<name>.merge
- It is not all too unusual for a branch to use "branch.<name>.remote"
- without "branch.<name>.merge". You may be using the 'push.default'
- configuration set to 'current', for example, and do
- $ git checkout -b side colleague/side
- $ git config branch.side.remote colleague
- However, "git remote rm" to remove the remote used in such a manner
- fails with
- "fatal: could not unset 'branch.<name>.merge'"
- because it assumes that a branch that has .remote defined must also
- have .merge defined. Detect the "cannot unset because it is not set
- to begin with" case and ignore it.
- Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git-check-ref-format: clarify documentation for --normalize
- Use of 'iff' may be confusing to people not familiar with this term.
- Improving the --normalize option's documentation to remove the use of
- 'iff', and clearly describe what happens when the condition is not met.
- Signed-off-by: Damien Regad <dregad@mantisbt.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'master' of git://github.com/nafmo/git-l10n-sv
- * 'master' of git://github.com/nafmo/git-l10n-sv:
- l10n: sv.po: Update Swedish translation (3139t0f0u)
- branch: record creation of renamed branch in HEAD's log
- Renaming the current branch adds an event to the current branch's log
- and to HEAD's log. However, the logged entries differ. The entry in
- the branch's log represents the entire renaming operation (the old and
- new hash are identical), whereas the entry in HEAD's log represents
- the deletion only (the new sha1 is null).
- Extend replace_each_worktree_head_symref(), whose only caller is
- branch_rename(), to take a reflog message argument. This allows the
- creation of the new ref to be recorded in HEAD's log. As a result,
- the renaming event is represented by two entries (a deletion and a
- creation entry) in HEAD's log.
- It's a bit unfortunate that the branch's log and HEAD's log now
- represent the renaming event in different ways. Given that the
- renaming operation is not atomic, the two-entry form is a more
- accurate representation of the operation and is more useful for
- debugging purposes if a failure occurs between the deletion and
- creation events. It would make sense to move the branch's log to the
- two-entry form, but this would involve changes to how the rename is
- carried out and to how the update flags and reflogs are processed for
- deletions, so it may not be worth the effort.
- Based-on-patch-by: Jeff King <peff@peff.net>
- Signed-off-by: Kyle Meyer <kyle@kyleam.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rename_ref: replace empty message in HEAD's log
- When the current branch is renamed, the deletion of the old ref is
- recorded in HEAD's log with an empty message. Now that delete_ref()
- accepts a reflog message, provide a more descriptive message by
- passing along the log message that is given to rename_ref().
- The next step will be to extend HEAD's log to also include the second
- part of the rename, the creation of the new branch.
- Helped-by: Jeff King <peff@peff.net>
- Signed-off-by: Kyle Meyer <kyle@kyleam.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- update-ref: pass reflog message to delete_ref()
- Now that delete_ref() accepts a reflog message, pass the user-provided
- message to delete_ref() rather than silently dropping it.
- Signed-off-by: Kyle Meyer <kyle@kyleam.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- delete_ref: accept a reflog message argument
- When the current branch is renamed with 'git branch -m/-M' or deleted
- with 'git update-ref -m<msg> -d', the event is recorded in HEAD's log
- with an empty message. In preparation for adding a more meaningful
- message to HEAD's log in these cases, update delete_ref() to take a
- message argument and pass it along to ref_transaction_delete().
- Modify all callers to pass NULL for the new message argument; no
- change in behavior is intended.
- Note that this is relevant for HEAD's log but not for the deleted
- ref's log, which is currently deleted along with the ref. Even if it
- were not, an entry for the deletion wouldn't be present in the deleted
- ref's log. files_transaction_commit() writes to the log if
- REF_NEEDS_COMMIT or REF_LOG_ONLY are set, but lock_ref_for_update()
- doesn't set REF_NEEDS_COMMIT for the deleted ref because REF_DELETING
- is set. In contrast, the update for HEAD has REF_LOG_ONLY set by
- split_head_update(), resulting in the deletion being logged.
- Signed-off-by: Kyle Meyer <kyle@kyleam.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'svn-escape-backslash' of git://bogomips.org/git-svn
- * 'svn-escape-backslash' of git://bogomips.org/git-svn:
- git-svn: escape backslashes in refnames
- l10n: sv.po: Update Swedish translation (3139t0f0u)
- Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
- l10n: de.po: translate 241 messages
- Translate 241 messages came from git.pot update in 673bfad09
- (l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)) and a4d94835a
- (l10n: git.pot: v2.12.0 round 2 (2 new)).
- Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
- Acked-by: Phillip Sz <phillip.szelat@gmail.com>
- Merge branch 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko
- * 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko:
- l10n: ko.po: Update Korean translation
- Merge branch 'master' of https://github.com/vnwildman/git
- * 'master' of https://github.com/vnwildman/git:
- l10n: vi.po (3139t): Updated 2 new messages for rc1
- l10n: ko.po: Update Korean translation
- Signed-off-by: Changwoo Ryu <cwryu@debian.org>
- l10n: vi.po (3139t): Updated 2 new messages for rc1
- Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
- init: document dotfiles exclusion on template copy
- Not just . and .., but any path that begins with dot is not copied
- when copying the template directory to a new repository. You can
- customize the template directory, copying some dotfiles might make
- sense, but it's actually a good thing not to, because you would not
- want to have your git directory copied in every git directory that
- is created should you decide to put your template directory under
- version control, for example. Plus, it might be used as a feature
- by people who would want to exclude some files.
- Signed-off-by: Grégoire Paris <postmaster@greg0ire.fr>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- l10n: fr.po: v2.12.0 round 2 3139t
- Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
- tempfile: set errno to a known value before calling ferror()
- In close_tempfile(), we return an error if ferror()
- indicated a previous failure, or if fclose() failed. In the
- latter case, errno is set and it is useful for callers to
- report it.
- However, if _only_ ferror() triggers, then the value of
- errno is based on whatever syscall happened to last fail,
- which may not be related to our filehandle at all. A caller
- cannot tell the difference between the two cases, and may
- use "die_errno()" or similar to report a nonsense errno value.
- One solution would be to actually pass back separate return
- values for the two cases, so a caller can write a more
- appropriate message for each case. But that makes the
- interface clunky.
- Instead, let's just set errno to the generic EIO in this case.
- That's not as descriptive as we'd like, but at least it's
- predictable. So it's better than the status quo in all cases
- but one: when the last syscall really did involve a failure
- on our filehandle, we'll be wiping that out. But that's a
- fragile thing for us to rely on.
- In any case, we'll let the errno result from fclose() take
- precedence over our value, as we know that's recent and
- accurate (and many I/O errors will persist through the
- fclose anyway).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Git 2.12-rc2
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rev-parse: fix several options when running in a subdirectory
- In addition to making git_path() aware of certain file names that need
- to be handled differently e.g. when running in worktrees, the commit
- 557bd833bb (git_path(): be aware of file relocation in $GIT_DIR,
- 2014-11-30) also snuck in a new option for `git rev-parse`:
- `--git-path`.
- On the face of it, there is no obvious bug in that commit's diff: it
- faithfully calls git_path() on the argument and prints it out, i.e. `git
- rev-parse --git-path <filename>` has the same precise behavior as
- calling `git_path("<filename>")` in C.
- The problem lies deeper, much deeper. In hindsight (which is always
- unfair), implementing the .git/ directory discovery in
- `setup_git_directory()` by changing the working directory may have
- allowed us to avoid passing around a struct that contains information
- about the current repository, but it bought us many, many problems.
- In this case, when being called in a subdirectory, `git rev-parse`
- changes the working directory to the top-level directory before calling
- `git_path()`. In the new working directory, the result is correct. But
- in the working directory of the calling script, it is incorrect.
- Example: when calling `git rev-parse --git-path HEAD` in, say, the
- Documentation/ subdirectory of Git's own source code, the string
- `.git/HEAD` is printed.
- Side note: that bug is hidden when running in a subdirectory of a
- worktree that was added by the `git worktree` command: in that case, the
- (correct) absolute path of the `HEAD` file is printed.
- In the interest of time, this patch does not go the "correct" route to
- introduce a struct with repository information (and removing global
- state in the process), instead this patch chooses to detect when the
- command was called in a subdirectory and forces the result to be an
- absolute path.
- While at it, we are also fixing the output of --git-common-dir and
- --shared-index-path.
- Lastly, please note that we reuse the same strbuf for all of the
- relative_path() calls; this avoids frequent allocation (and duplicated
- code), and it does not risk memory leaks, for two reasons: 1) the
- cmd_rev_parse() function does not return anywhere between the use of
- the new strbuf instance and its final release, and 2) git-rev-parse is
- one of these "one-shot" programs in Git, i.e. it exits after running
- for a very short time, meaning that all allocated memory is released
- with the exit() call anyway.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rev-parse tests: add tests executed from a subdirectory
- t2027-worktree-list has an incorrect expectation for --git-common-dir
- which has been adjusted and marked to expect failure.
- Some of the tests added have been marked to expect failure. These
- demonstrate a problem with the way that some options to git rev-parse
- behave when executed from a subdirectory of the main worktree.
- [jes: fixed incorrect assumption that objects/ lives in the
- worktree-specific git-dir (it lives in the common dir instead). Also
- adjusted t1700 so that the test case does not *need* to be the last
- one in that script.]
- Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- l10n: git.pot: v2.12.0 round 2 (2 new)
- Generate po/git.pot from v2.12.0-rc1 for git v2.12.0 l10n round 2.
- Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
- Merge branch 'master' of git://github.com/git-l10n/git-po
- * 'master' of git://github.com/git-l10n/git-po:
- l10n: vi.po: Updated Vietnamese translation (3137t)
- l10n: update Catalan translation
- l10n: sv.po: Update Swedish translation (3137t0f0u)
- l10n: fr.po: v2.11-rc0 first round
- l10n: ko.po: Update Korean translation
- l10n: fr.po: Fix a typo in the French translation
- l10n: fr.po: Remove gender specific adjectives
- l10n: fr.po: Fix typos
- l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)
- l10n: bg: Updated Bulgarian translation (2913t+0f+0u)
- l10n: fixes to Catalan translation
- l10n: zh_CN: review for git v2.11.0 l10n
- l10n: New Catalan translation maintainer
- Merge branch 'master' of https://github.com/vnwildman/git
- * 'master' of https://github.com/vnwildman/git:
- l10n: vi.po: Updated Vietnamese translation (3137t)
- Merge branch 'master' of https://github.com/Softcatala/git-po
- * 'master' of https://github.com/Softcatala/git-po:
- l10n: update Catalan translation
- l10n: vi.po: Updated Vietnamese translation (3137t)
- Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
- Hopefully the final batch of mini-topics before the final
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'jk/tempfile-ferror-fclose-confusion'
- Code clean-up.
- * jk/tempfile-ferror-fclose-confusion:
- tempfile: avoid "ferror | fclose" trick
- Merge branch 'dp/submodule-doc-markup-fix'
- Doc fix.
- * dp/submodule-doc-markup-fix:
- config.txt: fix formatting of submodule.alternateErrorStrategy section
- Merge branch 'jk/reset-to-break-a-commit-doc-updated'
- Doc update.
- * jk/reset-to-break-a-commit-doc-updated:
- reset: add an example of how to split a commit into two
- Merge branch 'jk/reset-to-break-a-commit-doc'
- Doc update.
- * jk/reset-to-break-a-commit-doc:
- Revert "reset: add an example of how to split a commit into two"
- Merge branch 'js/mingw-isatty'
- A hotfix for a topic already in 'master'.
- * js/mingw-isatty:
- mingw: make stderr unbuffered again
- Merge branch 'rs/strbuf-cleanup-in-rmdir-recursively'
- Code clean-up.
- * rs/strbuf-cleanup-in-rmdir-recursively:
- rm: reuse strbuf for all remove_dir_recursively() calls, again
- Merge branch 'rs/ls-files-partial-optim'
- "ls-files" run with pathspec has been micro-optimized to avoid
- having to memmove(3) unnecessary bytes.
- * rs/ls-files-partial-optim:
- ls-files: move only kept cache entries in prune_cache()
- ls-files: pass prefix length explicitly to prune_cache()
- Merge branch 'rs/cocci-check-free-only-null'
- A new coccinelle rule that catches a check of !pointer before the
- pointer is free(3)d, which most likely is a bug.
- * rs/cocci-check-free-only-null:
- cocci: detect useless free(3) calls
- Merge branch 'ls/p4-path-encoding'
- When "git p4" imports changelist that removes paths, it failed to
- convert pathnames when the p4 used encoding different from the one
- used on the Git side. This has been corrected.
- * ls/p4-path-encoding:
- git-p4: fix git-p4.pathEncoding for removed files
- tempfile: avoid "ferror | fclose" trick
- The current code wants to record an error condition from
- either ferror() or fclose(), but makes sure that we always
- call both functions. So it can't use logical-OR "||", which
- would short-circuit when ferror() is true. Instead, it uses
- bitwise-OR "|" to evaluate both functions and set one or
- more bits in the "err" flag if they reported a failure.
- Unlike logical-OR, though, bitwise-OR does not introduce a
- sequence point, and the order of evaluation for its operands
- is unspecified. So a compiler would be free to generate code
- which calls fclose() first, and then ferror() on the
- now-freed filehandle.
- There's no indication that this has happened in practice,
- but let's write it out in a way that follows the standard.
- Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- config.txt: fix formatting of submodule.alternateErrorStrategy section
- Add missing `::` after the title.
- Signed-off-by: David Pursehouse <dpursehouse@collab.net>
- Acked-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- clean: use warning_errno() when appropriate
- All these warning() calls are preceded by a system call. Report the
- actual error to help the user understand why we fail to remove
- something.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- reset: add an example of how to split a commit into two
- It is often useful to break a commit into multiple parts that are more
- logical separations. This can be tricky to learn how to do without the
- brute-force method if re-writing code or commit messages from scratch.
- Add a section to the git-reset documentation which shows an example
- process for how to use git add -p and git commit -c HEAD@{1} to
- interactively break a commit apart and re-use the original commit
- message as a starting point when making the new commit message.
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Revert "reset: add an example of how to split a commit into two"
- This reverts commit 7326451bedaa67d29afe02184b166e28d9393c91; a
- better rewrite will be queued separately.
- bisect_next_all: convert xsnprintf to xstrfmt
- Git can't run bisect between 2048+ commits if use russian
- translation, because the translated string is too long for the fixed
- buffer it uses (this can be reproduced "LANG=ru_RU.UTF8 git bisect
- start v4.9 v4.8" on linux sources).
- Use xstrfmt() to format the message string to sufficiently sized
- buffer instead to fix this.
- Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- stop_progress_msg: convert xsnprintf to xstrfmt
- Simplify code by replacing buffer allocation with a call to xstrfmt().
- Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- l10n: update Catalan translation
- Signed-off-by: Jordi Mas <jmas@softcatala.org>
- A bit more for -rc2
- Merge branch 'tg/stash-doc-cleanup'
- The documentation explained what "git stash" does to the working
- tree (after stashing away the local changes) in terms of "reset
- --hard", which was exposing an unnecessary implementation detail.
- * tg/stash-doc-cleanup:
- Documentation/stash: remove mention of git reset --hard
- Merge branch 'jk/doc-submodule-markup-fix'
- Doc markup fix.
- * jk/doc-submodule-markup-fix:
- docs/git-submodule: fix unbalanced quote
- Merge branch 'jk/doc-remote-helpers-markup-fix'
- Doc markup fix.
- * jk/doc-remote-helpers-markup-fix:
- docs/gitremote-helpers: fix unbalanced quotes
- show-branch: use skip_prefix to drop magic numbers
- We make several starts_with() calls, only to advance
- pointers. This is exactly what skip_prefix() is for, which
- lets us avoid manually-counted magic numbers.
- Helped-by: Pranit Bauva <pranit.bauva@gmail.com>
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'sb/doc-unify-bottom'
- Doc clean-up.
- * sb/doc-unify-bottom:
- Documentation: unify bottom "part of git suite" lines
- Merge branch 'sb/push-options-via-transport'
- The push-options given via the "--push-options" option were not
- passed through to external remote helpers such as "smart HTTP" that
- are invoked via the transport helper.
- * sb/push-options-via-transport:
- push options: pass push options to the transport helper
- Merge branch 'cw/completion'
- More command line completion (in contrib/) for recent additions.
- * cw/completion:
- completion: recognize more long-options
- completion: teach remote subcommands to complete options
- completion: teach replace to complete options
- completion: teach ls-remote to complete options
- completion: improve bash completion for git-add
- completion: add subcommand completion for rerere
- completion: teach submodule subcommands to complete options
- Merge branch 'rs/swap'
- Code clean-up.
- * rs/swap:
- graph: use SWAP macro
- diff: use SWAP macro
- use SWAP macro
- apply: use SWAP macro
- add SWAP macro
- Merge branch 'sb/submodule-doc'
- Doc updates.
- * sb/submodule-doc:
- submodule update documentation: don't repeat ourselves
- submodule documentation: add options to the subcommand
- grep: treat revs the same for --untracked as for --no-index
- git-grep has always disallowed grepping in a tree (as
- opposed to the working directory) with both --untracked
- and --no-index. But we traditionally did so by first
- collecting the revs, and then complaining when any were
- provided.
- The --no-index option recently learned to detect revs
- much earlier. This has two user-visible effects:
- - we don't bother to resolve revision names at all. So
- when there's a rev/path ambiguity, we always choose to
- treat it as a path.
- - likewise, when you do specify a revision without "--",
- the error you get is "no such path" and not "--untracked
- cannot be used with revs".
- The rationale for doing this with --no-index is that it is
- meant to be used outside a repository, and so parsing revs
- at all does not make sense.
- This patch gives --untracked the same treatment. While it
- _is_ meant to be used in a repository, it is explicitly
- about grepping the non-repository contents. Telling the user
- "we found a rev, but you are not allowed to use revs" is
- not really helpful compared to "we treated your argument as
- a path, and could not find it".
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
- To push from or fetch to the current repository, remote helpers need
- to know what repository that is. Accordingly, Git sets the GIT_DIR
- environment variable to the path to the current repository when
- invoking remote helpers.
- There is a special case it does not handle: "git ls-remote" and "git
- archive --remote" can be run to inspect a remote repository without
- being run from any local repository. GIT_DIR is not useful in this
- scenario:
- - if we are not in a repository, we don't need to set GIT_DIR to
- override an existing GIT_DIR value from the environment. If GIT_DIR
- is present then we would be in a repository if it were valid and
- would have called die() if it weren't.
- - not setting GIT_DIR may cause a helper to do the usual discovery
- walk to find the repository. But we know we're not in one, or we
- would have found it ourselves. So in the worst case it may expend
- a little extra effort to try to find a repository and fail (for
- example, remote-curl would do this to try to find repository-level
- configuration).
- So leave GIT_DIR unset in this case. This makes GIT_DIR easier to
- understand for remote helper authors and makes transport code less of
- a special case for repository discovery.
- Noticed using b1ef400e (setup_git_env: avoid blind fall-back to
- ".git", 2016-10-20) from 'next':
- $ cd /tmp
- $ git ls-remote https://kernel.googlesource.com/pub/scm/git/git
- fatal: BUG: setup_git_env called without repository
- Helped-by: Jeff King <peff@peff.net>
- Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- remote: avoid reading $GIT_DIR config in non-repo
- The "git ls-remote" command can be run outside of a
- repository, but needs to look up configured remotes. The
- config code is smart enough to handle this case itself, but
- we also check the historical "branches" and "remotes" paths
- in $GIT_DIR. The git_path() function causes us to blindly
- look at ".git/remotes", even if we know we aren't in a git
- repository.
- For now, this is just an unlikely bug (you probably don't
- have such a file if you're not in a repository), but it will
- become more obvious once we merge b1ef400ee (setup_git_env:
- avoid blind fall-back to ".git", 2016-10-20):
- [now]
- $ git ls-remote
- fatal: No remote configured to list refs from.
- [with b1ef400ee]
- $ git ls-remote
- fatal: BUG: setup_git_env called without repository
- We can fix this by skipping these sources entirely when
- we're outside of a repository.
- The test is a little more complex than the demonstration
- above. Rather than detect the correct behavior by parsing
- the error message, we can actually set up a case where the
- remote name we give is a valid repository, but b1ef400ee
- would cause us to die in the configuration step.
- This test doesn't fail now, but it future-proofs us for the
- b1ef400ee change.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- show-branch: store resolved head in heap buffer
- We resolve HEAD and copy the result to a fixed-size buffer
- with memcpy, never checking that it actually fits. This bug
- dates back to 8098a178b (Add git-symbolic-ref, 2005-09-30).
- Before that we used readlink(), which took a maximum buffer
- size.
- We can fix this by using resolve_refdup(), which duplicates
- the buffer on the heap. That also lets us just check
- for a NULL pointer to see if we have resolved HEAD, and
- drop the extra head_p variable.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- show-branch: drop head_len variable
- We copy the result of resolving HEAD into a buffer and keep
- track of its length. But we never actually use the length
- for anything besides the copy. Let's stop passing it around.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: do not diagnose misspelt revs with --no-index
- If we are using --no-index, then our arguments cannot be
- revs in the first place. Not only is it pointless to
- diagnose them, but if we are not in a repository, we should
- not be trying to resolve any names.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: avoid resolving revision names in --no-index case
- We disallow the use of revisions with --no-index, but we
- don't actually check and complain until well after we've
- parsed the revisions.
- This is the cause of a few problems:
- 1. We shouldn't be calling get_sha1() at all when we aren't
- in a repository, as it might access the ref or object
- databases. For now, this should generally just return
- failure, but eventually it will become a BUG().
- 2. When there's a "--" disambiguator and you're outside a
- repository, we'll complain early with "unable to resolve
- revision". But we can give a much more specific error.
- 3. When there isn't a "--" disambiguator, we still do the
- normal rev/path checks. This is silly, as we know we
- cannot have any revs with --no-index. Everything we see
- must be a path.
- Outside of a repository this doesn't matter (since we
- know it won't resolve), but inside one, we may complain
- unnecessarily if a filename happens to also match a
- refname.
- This patch skips the get_sha1() call entirely in the
- no-index case, and behaves as if it failed (with the
- exception of giving a better error message).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: fix "--" rev/pathspec disambiguation
- If we see "git grep pattern rev -- file" then we apply the
- usual rev/pathspec disambiguation rules: any "rev" before
- the "--" must be a revision, and we do not need to apply the
- verify_non_filename() check.
- But there are two bugs here:
- 1. We keep a seen_dashdash flag to handle this case, but
- we set it in the same left-to-right pass over the
- arguments in which we parse "rev".
- So when we see "rev", we do not yet know that there is
- a "--", and we mistakenly complain if there is a
- matching file.
- We can fix this by making a preliminary pass over the
- arguments to find the "--", and only then checking the rev
- arguments.
- 2. If we can't resolve "rev" but there isn't a dashdash,
- that's OK. We treat it like a path, and complain later
- if it doesn't exist.
- But if there _is_ a dashdash, then we know it must be a
- rev, and should treat it as such, complaining if it
- does not resolve. The current code instead ignores it
- and tries to treat it like a path.
- This patch fixes both bugs, and tries to comment the parsing
- flow a bit better.
- It adds tests that cover the two bugs, but also some related
- situations (which already worked, but this confirms that our
- fixes did not break anything).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: re-order rev-parsing loop
- We loop over the arguments, but every branch of the loop
- hits either a "continue" or a "break". Surely we can make
- this simpler.
- The final conditional is:
- if (arg is a rev) {
- ... handle rev ...
- continue;
- }
- break;
- We can rewrite this as:
- if (arg is not a rev)
- break;
- ... handle rev ...
- That makes the flow a little bit simpler, and will make
- things much easier to follow when we add more logic in
- future patches.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: do not unnecessarily query repo for "--"
- When running a command of the form
- git grep --no-index pattern -- path
- in the absence of a Git repository, an error message will be printed:
- fatal: BUG: setup_git_env called without repository
- This is because "git grep" tries to interpret "--" as a rev. "git grep"
- has always tried to first interpret "--" as a rev for at least a few
- years, but this issue was upgraded from a pessimization to a bug in
- commit 59332d1 ("Resurrect "git grep --no-index"", 2010-02-06), which
- calls get_sha1 regardless of whether --no-index was specified. This bug
- appeared to be benign until commit b1ef400 ("setup_git_env: avoid blind
- fall-back to ".git"", 2016-10-20) when Git was taught to die in this
- situation. (This "git grep" bug appears to be one of the bugs that
- commit b1ef400 is meant to flush out.)
- Therefore, always interpret "--" as signaling the end of options,
- instead of trying to interpret it as a rev first.
- Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: move thread initialization a little lower
- Originally, we set up the threads for grep before parsing
- the non-option arguments. In 53b8d931b (grep: disable
- threading in non-worktree case, 2011-12-12), the thread code
- got bumped lower in the function because it now needed to
- know whether we got any revision arguments.
- That put a big block of code in between the parsing of revs
- and the parsing of pathspecs, both of which share some loop
- variables. That makes it harder to read the code than the
- original, where the shared loops were right next to each
- other.
- Let's bump the thread initialization until after all of the
- parsing is done.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mingw: make stderr unbuffered again
- When removing the hack for isatty(), we actually removed more than just
- an isatty() hack: we removed the hack where internal data structures of
- the MSVC runtime are modified in order to redirect stdout/stderr.
- Instead of using that hack (that does not work with newer versions of
- the runtime, anyway), we replaced it by reopening the respective file
- descriptors.
- What we forgot was to mark stderr as unbuffered again.
- Reported by Hannes Sixt. Fixed with Jeff Hostetler's assistance.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Tested-by: Johannes Sixt <j6t@kdbg.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- gc: ignore old gc.log files
- A server can end up in a state where there are lots of unreferenced
- loose objects (say, because many users are doing a bunch of rebasing
- and pushing their rebased branches). Running "git gc --auto" in
- this state would cause a gc.log file to be created, preventing
- future auto gcs, causing pack files to pile up. Since many git
- operations are O(n) in the number of pack files, this would lead to
- poor performance.
- Git should never get itself into a state where it refuses to do any
- maintenance, just because at some point some piece of the maintenance
- didn't make progress.
- Teach Git to ignore gc.log files which are older than (by default)
- one day old, which can be tweaked via the gc.logExpiry configuration
- variable. That way, these pack files will get cleaned up, if
- necessary, at least once per day. And operators who find a need for
- more-frequent gcs can adjust gc.logExpiry to meet their needs.
- There is also some cleanup: a successful manual gc, or a
- warning-free auto gc with an old log file, will remove any old
- gc.log files.
- It might still happen that manual intervention is required
- (e.g. because the repo is corrupt), but at the very least it won't
- be because Git is too dumb to try again.
- Signed-off-by: David Turner <dturner@twosigma.com>
- Helped-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- read_loose_refs(): read refs using resolve_ref_recursively()
- There is no need to call read_ref_full() or resolve_gitlink_ref() from
- read_loose_refs(), because we already have a ref_store object in hand.
- So we can call resolve_ref_recursively() ourselves. Happily, this
- unifies the code for the submodule vs. non-submodule cases.
- This requires resolve_ref_recursively() to be exposed to the refs
- subsystem, though not to non-refs code.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rm: reuse strbuf for all remove_dir_recursively() calls, again
- Don't throw the memory allocated for remove_dir_recursively() away after
- a single call, use it for the other entries as well instead.
- This change was done before in deb8e15a (rm: reuse strbuf for all
- remove_dir_recursively() calls), but was reverted as a side-effect of
- 55856a35 (rm: absorb a submodules git dir before deletion). Reinstate
- the optimization.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation/stash: remove mention of git reset --hard
- Don't mention git reset --hard in the documentation for git stash save.
- It's an implementation detail that doesn't matter to the end user and
- thus shouldn't be exposed to them. In addition it's not quite true for
- git stash -p, and will not be true when a filename argument to limit the
- stash to a few files is introduced.
- Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- docs/git-submodule: fix unbalanced quote
- The documentation gives an example of the submodule foreach
- command that uses both backticks and single-quotes. We stick
- the whole thing inside "+" markers to make it monospace, but
- the inside punctuation still needs escaping. We handle the
- backticks with "{backtick}", and use backslash-escaping for
- the single-quotes.
- But we missed the escaping on the second quote. Fortunately,
- asciidoc renders this unbalanced quote as we want (showing
- the quote), but asciidoctor does not. We could fix it by
- adding the missing backslash.
- However, let's take a step back. Even when rendered
- correctly, it's hard to read a long command stuck into the
- middle of a paragraph, and the important punctuation is hard
- to notice. Let's instead bump it into its own single-line
- code block. That makes both the source and the rendered
- result more readable, and as a bonus we don't have to worry
- about quoting at all.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- docs/gitremote-helpers: fix unbalanced quotes
- Each of these options is missing the closing single-quote on
- the option name. This understandably confuses asciidoc,
- which ends up rendering a stray quote, like:
- option cloning {'true|false}
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: restore removed line continuating backslash
- Recent commit 1cd23e9e0 (completion: don't use __gitdir() for git
- commands, 2017-02-03) rewrapped a couple of long lines, and while
- doing so it inadvertently removed a '\' from the end of a line, thus
- breaking completion for 'git config remote.name.push <TAB>'.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ls-files: move only kept cache entries in prune_cache()
- prune_cache() first identifies those entries at the start of the sorted
- array that can be discarded. Then it moves the rest of the entries up.
- Last it identifies the unwanted trailing entries among the moved ones
- and cuts them off.
- Change the order: Identify both start *and* end of the range to keep
- first and then move only those entries to the top. The resulting code
- is slightly shorter and a bit more efficient.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Reviewed-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ls-files: pass prefix length explicitly to prune_cache()
- The function prune_cache() relies on the fact that it is only called on
- max_prefix and sneakily uses the matching global variable max_prefix_len
- directly. Tighten its interface by passing both the string and its
- length as parameters. While at it move the NULL check into the function
- to collect all cache-pruning related logic in one place.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Reviewed-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'master' of git://github.com/nafmo/git-l10n-sv
- * 'master' of git://github.com/nafmo/git-l10n-sv:
- l10n: sv.po: Update Swedish translation (3137t0f0u)
- Merge branch 'fr_v2.11.0_rnd1' of git://github.com/jnavila/git
- * 'fr_v2.11.0_rnd1' of git://github.com/jnavila/git:
- l10n: fr.po: v2.11-rc0 first round
- l10n: fr.po: Fix a typo in the French translation
- l10n: fr.po: Remove gender specific adjectives
- l10n: fr.po: Fix typos
- cocci: detect useless free(3) calls
- Add a semantic patch for removing checks that cause free(3) to only be
- called with a NULL pointer, as that must be a programming mistake.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- l10n: sv.po: Update Swedish translation (3137t0f0u)
- Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
- l10n: fr.po: v2.11-rc0 first round
- Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
- l10n: ko.po: Update Korean translation
- Signed-off-by: Changwoo Ryu <cwryu@debian.org>
- preload-index: avoid lstat for skip-worktree items
- Teach preload-index to avoid lstat() calls for index-entries
- with skip-worktree bit set. This is a performance optimization.
- During a sparse-checkout, the skip-worktree bit is set on items
- that were not populated and therefore are not present in the
- worktree. The per-thread preload-index loop performs a series
- of tests on each index-entry as it attempts to compare the
- worktree version with the index and mark them up-to-date.
- This patch short-cuts that work.
- On a Windows 10 system with a very large repo (450MB index)
- and various levels of sparseness, performance was improved
- in the {preloadindex=true, fscache=false} case by 80% and
- in the {preloadindex=true, fscache=true} case by 20% for various
- commands.
- Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git-p4: fix git-p4.pathEncoding for removed files
- In a9e38359e3 we taught git-p4 a way to re-encode path names from what
- was used in Perforce to UTF-8. This path re-encoding worked properly for
- "added" paths. "Removed" paths were not re-encoded and therefore
- different from the "added" paths. Consequently, these files were not
- removed in a git-p4 cloned Git repository because the path names did not
- match.
- Fix this by moving the re-encoding to a place that affects "added" and
- "removed" paths. Add a test to demonstrate the issue.
- Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
- Reviewed-by: Luke Diamand <luke@diamand.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- connect.c: stop conflating ssh command names and overrides
- dd33e07766 ("connect: Add the envvar GIT_SSH_VARIANT and ssh.variant
- config", 2017-02-01) attempted to add support for configuration and
- environment variable to override the different handling of
- port_option and needs_batch settings suitable for variants of the
- ssh implementation that was autodetected by looking at the ssh
- command name. Because it piggybacked on the code that turns command
- name to specific override (e.g. "plink.exe" and "plink" means
- port_option needs to be set to 'P' instead of the default 'p'), yet
- it defined a separate namespace for these overrides (e.g. "putty"
- can be usable to signal that port_option needs to be 'P'), however,
- it made the auto-detection based on the command name less robust
- (e.g. the code now accepts "putty" as a SSH command name and applies
- the same override).
- Separate the code that interprets the override that was read from
- the configuration & environment from the original code that handles
- the command names, as they are in separate namespaces, to fix this
- confusion.
- This incidentally also makes it easier for future enhancement of the
- override syntax (e.g. "port_option=p,needs_batch=1" may want to be
- accepted as a more explicit syntax) without affecting the code for
- auto-detection based on the command name.
- While at it, update the return type of the handle_ssh_variant()
- helper function to void; the caller does not use it, and the
- function does not return any meaningful value.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: don't error out on all-exclusionary pathspec patterns
- Instead of erroring out and telling the user that they should add a
- positive pattern that covers everything else, just _do_ that.
- For commands where we honor the current cwd by default (ie grep, ls-files
- etc), we make that default positive pathspec be the current working
- directory. And for commands that default to the whole project (ie diff,
- log, etc), the default positive pathspec is the whole project.
- Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec magic: add '^' as alias for '!'
- The choice of '!' for a negative pathspec ends up not only not matching
- what we do for revisions, it's also a horrible character for shell
- expansion since it needs quoting.
- So add '^' as an alternative alias for an excluding pathspec entry.
- Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Git 2.12-rc1
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'nd/rev-list-all-includes-HEAD-doc'
- Doc update.
- * nd/rev-list-all-includes-HEAD-doc:
- rev-list-options.txt: update --all about HEAD
- Merge branch 'rs/fill-directory-optim'
- Code clean-up.
- * rs/fill-directory-optim:
- dir: avoid allocation in fill_directory()
- Merge branch 'jk/log-graph-name-only'
- "git log --graph" did not work well with "--name-only", even though
- other forms of "diff" output were handled correctly.
- * jk/log-graph-name-only:
- diff: print line prefix for --name-only output
- Merge branch 'da/t7800-cleanup'
- Test updates.
- * da/t7800-cleanup:
- t7800: replace "wc -l" with test_line_count
- Merge branch 'dl/difftool-doc-no-gui-option'
- Doc update.
- * dl/difftool-doc-no-gui-option:
- Document the --no-gui option in difftool
- Merge branch 'js/difftool-builtin'
- A few hot-fixes to C-rewrite of "git difftool".
- * js/difftool-builtin:
- t7800: simplify basic usage test
- difftool: fix bug when printing usage
- Merge branch 'rs/p5302-create-repositories-before-tests'
- Adjust a perf test to new world order where commands that do
- require a repository are really strict about having a repository.
- * rs/p5302-create-repositories-before-tests:
- p5302: create repositories for index-pack results explicitly
- Merge branch 'ps/worktree-prune-help-fix'
- Incorrect usage help message for "git worktree prune" has been fixed.
- * ps/worktree-prune-help-fix:
- worktree: fix option descriptions for `prune`
- Merge branch 'ew/complete-svn-authorship-options'
- Correct command line completion (in contrib/) on "git svn"
- * ew/complete-svn-authorship-options:
- completion: fix git svn authorship switches
- Merge branch 'jk/reset-to-break-a-commit-doc'
- A minor doc update.
- * jk/reset-to-break-a-commit-doc:
- reset: add an example of how to split a commit into two
- Merge branch 'bw/push-submodule-only'
- Add missing documentation update to a recent topic.
- * bw/push-submodule-only:
- completion: add completion for --recurse-submodules=only
- doc: add doc for git-push --recurse-submodules=only
- files_ref_store::submodule: use NULL for the main repository
- The old practice of storing the empty string in this member for the main
- repository was a holdover from before 00eebe3 (refs: create a base class
- "ref_store" for files_ref_store, 2016-09-04), when the submodule was
- stored in a flex array at the end of `struct files_ref_store`. Storing
- NULL for this case is more idiomatic and a tiny bit less code.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- base_ref_store_init(): remove submodule argument
- This is another step towards weakening the 1:1 relationship between
- ref_stores and submodules.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- refs: push the submodule attribute down
- Push the submodule attribute down from ref_store to files_ref_store.
- This is another step towards loosening the 1:1 connection between
- ref_stores and submodules.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- refs: store submodule ref stores in a hashmap
- Aside from scaling better, this means that the submodule name needn't be
- stored in the ref_store instance anymore (which will be changed in a
- moment). This, in turn, will help loosen the strict 1:1 relationship
- between ref_stores and submodules.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- register_ref_store(): new function
- Move the responsibility for registering the ref_store for a submodule
- from base_ref_store_init() to a new function, register_ref_store(). Call
- the latter from ref_store_init().
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- refs: remove some unnecessary handling of submodule == ""
- The only external entry point to the ref_store lookup functions is
- get_ref_store(), which ensures that submodule == "" is passed along as
- NULL. So ref_store_init() and lookup_ref_store() don't have to handle
- submodule being specified as the empty string.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- refs: make some ref_store lookup functions private
- The following functions currently don't need to be exposed:
- * ref_store_init()
- * lookup_ref_store()
- That might change in the future, but for now make them private.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- refs: reorder some function definitions
- This avoids the need to add forward declarations in the next step.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: unify bottom "part of git suite" lines
- We currently have 168 man pages that mention they are part of Git, you
- can check yourself easily via:
- $ git grep "Part of the linkgit:git\[1\] suite" |wc -l
- 168
- However some have a trailing period, i.e.
- $ git grep "Part of the linkgit:git\[1\] suite." |wc -l
- 8
- Unify the bottom line in all man pages to not end with a period.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rebase -i: use the rebase--helper builtin
- Now that the sequencer learned to process a "normal" interactive rebase,
- we use it. The original shell script is still used for "non-normal"
- interactive rebases, i.e. when --root or --preserve-merges was passed.
- Please note that the --root option (via the $squash_onto variable) needs
- special handling only for the very first command, hence it is still okay
- to use the helper upon continue/skip.
- Also please note that the --no-ff setting is volatile, i.e. when the
- interactive rebase is interrupted at any stage, there is no record of
- it. Therefore, we have to pass it from the shell script to the
- rebase--helper.
- Note: the test t3404 had to be adjusted because the the error messages
- produced by the sequencer comply with our current convention to start with
- a lower-case letter.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rebase--helper: add a builtin helper for interactive rebases
- Git's interactive rebase is still implemented as a shell script, despite
- its complexity. This implies that it suffers from the portability point
- of view, from lack of expressibility, and of course also from
- performance. The latter issue is particularly serious on Windows, where
- we pay a hefty price for relying so much on POSIX.
- Unfortunately, being such a huge shell script also means that we missed
- the train when it would have been relatively easy to port it to C, and
- instead piled feature upon feature onto that poor script that originally
- never intended to be more than a slightly pimped cherry-pick in a loop.
- To open the road toward better performance (in addition to all the other
- benefits of C over shell scripts), let's just start *somewhere*.
- The approach taken here is to add a builtin helper that at first intends
- to take care of the parts of the interactive rebase that are most
- affected by the performance penalties mentioned above.
- In particular, after we spent all those efforts on preparing the sequencer
- to process rebase -i's git-rebase-todo scripts, we implement the `git
- rebase -i --continue` functionality as a new builtin, git-rebase--helper.
- Once that is in place, we can work gradually on tackling the rest of the
- technical debt.
- Note that the rebase--helper needs to learn about the transient
- --ff/--no-ff options of git-rebase, as the corresponding flag is not
- persisted to, and re-read from, the state directory.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- push options: pass push options to the transport helper
- When using non-builtin protocols relying on a transport helper
- (such as http), push options are not propagated to the helper.
- The user could ask for push options and a push would seemingly succeed,
- but the push options would never be transported to the server,
- misleading the users expectation.
- Fix this by propagating the push options to the transport helper.
- This is only addressing the first issue of
- (1) the helper protocol does not propagate push-option
- (2) the http helper is not prepared to handle push-option
- Once we fix (2), the http transport helper can make use of push options
- as well, but that happens as a follow up. (1) is a bug fix, whereas (2)
- is a feature, which is why we only do (1) here.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- tag: generate useful reflog message
- When tags are created with `--create-reflog` or with the option
- `core.logAllRefUpdates` set to 'always', a reflog is created for them.
- So far, the description of reflog entries for tags was empty, making the
- reflog hard to understand. For example:
- 6e3a7b3 refs/tags/test@{0}:
- Now, a reflog message is generated when creating a tag, following the
- pattern "tag: tagging <short-sha1> (<description>)". If
- GIT_REFLOG_ACTION is set, the message becomes "$GIT_REFLOG_ACTION
- (<description>)" instead. If the tag references a commit object, the
- description is set to the subject line of the commit, followed by its
- commit date. For example:
- 6e3a7b3 refs/tags/test@{0}: tag: tagging 6e3a7b3398 (Git 2.12-rc0, 2017-02-03)
- If the tag points to a tree/blob/tag objects, the following static
- strings are taken as description:
- - "tree object"
- - "blob object"
- - "other tag object"
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- receive-pack: avoid duplicates between our refs and alternates
- We de-duplicate ".have" refs among themselves, but never
- check if they are duplicates of our local refs. It's not
- unreasonable that they would be if we are a "--shared" or
- "--reference" clone of a similar repository; we'd have all
- the same tags.
- We can handle this by inserting our local refs into the
- oidset, but obviously not suppressing duplicates (since the
- refnames are important).
- Note that this also switches the order in which we advertise
- refs, processing ours first and then any alternates. The
- order shouldn't matter (and arguably showing our refs first
- makes more sense).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- receive-pack: treat namespace .have lines like alternates
- Namely, de-duplicate them. We use the same set as the
- alternates, since we call them both ".have" (i.e., there is
- no value in showing one versus the other).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- receive-pack: fix misleading namespace/.have comment
- The comment claims that we handle alternate ".have" lines
- through this function, but that hasn't been the case since
- 85f251045 (write_head_info(): handle "extra refs" locally,
- 2012-01-06).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- receive-pack: use oidset to de-duplicate .have lines
- If you have an alternate object store with a very large
- number of refs, the peak memory usage of the sha1_array can
- grow high, even if most of them are duplicates that end up
- not being printed at all.
- The similar for_each_alternate_ref() code-paths in
- fetch-pack solve this by using flags in "struct object" to
- de-duplicate (and so are relying on obj_hash at the core).
- But we don't have a "struct object" at all in this case. We
- could call lookup_unknown_object() to get one, but if our
- goal is reducing memory footprint, it's not great:
- - an unknown object is as large as the largest object type
- (a commit), which is bigger than an oidset entry
- - we can free the memory after our ref advertisement, but
- "struct object" entries persist forever (and the
- receive-pack may hang around for a long time, as the
- bottleneck is often client upload bandwidth).
- So let's use an oidset. Note that unlike a sha1-array it
- doesn't sort the output as a side effect. However, our
- output is at least stable, because for_each_alternate_ref()
- will give us the sha1s in ref-sorted order.
- In one particularly pathological case with an alternate that
- has 60,000 unique refs out of 80 million total, this reduced
- the peak heap usage of "git receive-pack . </dev/null" from
- 13GB to 14MB.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- add oidset API
- This is similar to many of our uses of sha1-array, but it
- overcomes one limitation of a sha1-array: when you are
- de-duplicating a large input with relatively few unique
- entries, sha1-array uses 20 bytes per non-unique entry.
- Whereas this set will use memory linear in the number of
- unique entries (albeit a few more than 20 bytes due to
- hashmap overhead).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fetch-pack: cache results of for_each_alternate_ref
- We may run for_each_alternate_ref() twice, once in
- find_common() and once in everything_local(). This operation
- can be expensive, because it involves running a sub-process
- which must freshly load all of the alternate's refs from
- disk.
- Let's cache and reuse the results between the two calls. We
- can make some optimizations based on the particular use
- pattern in fetch-pack to keep our memory usage down.
- The first is that we only care about the sha1s, not the refs
- themselves. So it's OK to store only the sha1s, and to
- suppress duplicates. The natural fit would therefore be a
- sha1_array.
- However, sha1_array's de-duplication happens only after it
- has read and sorted all entries. It still stores each
- duplicate. For an alternate with a large number of refs
- pointing to the same commits, this is a needless expense.
- Instead, we'd prefer to eliminate duplicates before putting
- them in the cache, which implies using a hash. We can
- further note that fetch-pack will call parse_object() on
- each alternate sha1. We can therefore keep our cache as a
- set of pointers to "struct object". That gives us a place to
- put our "already seen" bit with an optimized hash lookup.
- And as a bonus, the object stores the sha1 for us, so
- pointer-to-object is all we need.
- There are two extra optimizations I didn't do here:
- - we actually store an array of pointer-to-object.
- Technically we could just walk the obj_hash table
- looking for entries with the ALTERNATE flag set (because
- our use case doesn't care about the order here).
- But that hash table may be mostly composed of
- non-ALTERNATE entries, so we'd waste time walking over
- them. So it would be a slight win in memory use, but a
- loss in CPU.
- - the items we pull out of the cache are actual "struct
- object"s, but then we feed "obj->sha1" to our
- sub-functions, which promptly call parse_object().
- This second parse is cheap, because it starts with
- lookup_object() and will bail immediately when it sees
- we've already parsed the object. We could save the extra
- hash lookup, but it would involve refactoring the
- functions we call. It may or may not be worth the
- trouble.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- for_each_alternate_ref: replace transport code with for-each-ref
- The current method for getting the refs from an alternate is
- to run upload-pack in the alternate and parse its output
- using the normal transport code. This works and is
- reasonably short, but it has a very bad memory footprint
- when there are a lot of refs in the alternate. There are two
- problems:
- 1. It reads in all of the refs before passing any back to
- us. Which means that our peak memory usage has to store
- every ref (including duplicates for peeled variants),
- even if our callback could determine that some are not
- interesting (e.g., because they point to the same sha1
- as another ref).
- 2. It allocates a "struct ref" for each one. Among other
- things, this contains 3 separate 20-byte oids, along
- with the name and various pointers. That can add up,
- especially if the callback is only interested in the
- sha1 (which it can store in a sha1_array as just 20
- bytes).
- On a particularly pathological case, where the alternate had
- over 80 million refs pointing to only around 60,000 unique
- objects, the peak heap usage of "git clone --reference" grew
- to over 25GB.
- This patch instead calls git-for-each-ref in the alternate
- repository, and passes each line to the callback as we read
- it. That drops the peak heap of the same command to 50MB.
- I considered and rejected a few alternatives.
- We could read all of the refs in the alternate using our own
- ref code, just as we do with submodules. However, as memory
- footprint is one of the concerns here, we want to avoid
- loading those refs into our own memory as a whole.
- It's possible that this will be a better technique in the
- future when the ref code can more easily iterate without
- loading all of packed-refs into memory.
- Another option is to keep calling upload-pack, and just
- parse its output ourselves in a streaming fashion. Besides
- for-each-ref being simpler (we get to define the format
- ourselves, and don't have to deal with speaking the git
- protocol), it's more flexible for possible future changes.
- For instance, it might be useful for the caller to be able
- to limit the set of "interesting" alternate refs. The
- motivating example is one where many "forks" of a particular
- repository share object storage, and the shared storage has
- refs for each fork (which is why so many of the refs are
- duplicates; each fork has the same tags). A plausible
- future optimization would be to ask for the alternate refs
- for just _one_ fork (if you had some out-of-band way of
- knowing which was the most interesting or important for the
- current operation).
- Similarly, no callbacks actually care about the symref value
- of alternate refs, and as before, this patch ignores them
- entirely. However, if we wanted to add them, for-each-ref's
- "%(symref)" is going to be more flexible than upload-pack,
- because the latter only handles the HEAD symref due to
- historical constraints.
- There is one potential downside, though: unlike upload-pack,
- our for-each-ref command doesn't report the peeled value of
- refs. The existing code calls the alternate_ref_fn callback
- twice for tags: once for the tag, and once for the peeled
- value with the refname set to "ref^{}".
- For the callers in fetch-pack, this doesn't matter at all.
- We immediately peel each tag down to a commit either way (so
- there's a slight improvement, as do not bother passing the
- redundant data over the pipe). For the caller in
- receive-pack, it means we will not advertise the peeled
- values of tags in our alternate. However, we also don't
- advertise peeled values for our _own_ tags, so this is
- actually making things more consistent.
- It's unclear whether receive-pack advertising peeled values
- is a win or not. On one hand, giving more information to the
- other side may let it omit some objects from the push. On
- the other hand, for tags which both sides have, they simply
- bloat the advertisement. The upload-pack advertisement of
- git.git is about 30% larger than the receive-pack
- advertisement due to its peeled information.
- This patch omits the peeled information from
- for_each_alternate_ref entirely, and leaves it up to the
- caller whether they want to dig up the information.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- for_each_alternate_ref: pass name/oid instead of ref struct
- Breaking down the fields in the interface makes it easier to
- change the backend of for_each_alternate_ref to something
- that doesn't use "struct ref" internally.
- The only field that callers actually look at is the oid,
- anyway. The refname is kept in the interface as a plausible
- thing for future code to want.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- for_each_alternate_ref: use strbuf for path allocation
- We have a string with ".../objects" pointing to the
- alternate object store, and overwrite bits of it to look at
- other paths in the (potential) git repository holding it.
- This works because the only path we care about is "refs",
- which is shorter than "objects".
- Using a strbuf to hold the path lets us get rid of some
- magic numbers, and makes it more obvious that the memory
- operations are safe.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- for_each_alternate_ref: stop trimming trailing slashes
- The real_pathdup() function will have removed extra slashes
- for us already (on top of the normalize_path() done when we
- created the alternate_object_database struct in the first
- place).
- Incidentally, this also fixes the case where the path is
- just "/", which would read off the start of the array.
- That doesn't seem possible to trigger in practice, though,
- as link_alt_odb_entry() blindly eats trailing slashes,
- including a bare "/".
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- for_each_alternate_ref: handle failure from real_pathdup()
- In older versions of git, if real_path() failed to resolve
- the alternate object store path, we would die() with an
- error. However, since 4ac9006f8 (real_path: have callers use
- real_pathdup and strbuf_realpath, 2016-12-12) we use the
- real_pathdup() function, which may return NULL. Since we
- don't check the return value, we can segfault.
- This is hard to trigger in practice, since we check that the
- path is accessible before creating the alternate_object_database
- struct. But it could be removed racily, or we could see a
- transient filesystem error.
- We could restore the original behavior by switching back to
- xstrdup(real_path()). However, dying is probably not the
- best option here. This whole function is best-effort
- already; there might not even be a repository around the
- shared objects at all. And if the alternate store has gone
- away, there are no objects to show.
- So let's just quietly return, as we would if we failed to
- open "refs/", or if upload-pack failed to start, etc.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- diff: print line prefix for --name-only output
- If you run "git log --graph --name-only", the pathnames are
- not indented to go along with their matching commits (unlike
- all of the other diff formats). We need to output the line
- prefix for each item before writing it.
- The tests cover both --name-status and --name-only. The
- former actually gets this right already, because it builds
- on the --raw format functions. It's only --name-only which
- uses its own code (and this fix mirrors the code in
- diff_flush_raw()).
- Note that the tests don't follow our usual style of setting
- up the "expect" output inside the test block. This matches
- the surrounding style, but more importantly it is easier to
- read: we don't have to worry about embedded single-quotes,
- and the leading indentation is more obvious.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- dir: avoid allocation in fill_directory()
- Pass the match member of the first pathspec item directly to
- read_directory() instead of using common_prefix() to duplicate it first,
- thus avoiding memory duplication, strlen(3) and free(3).
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rev-list-options.txt: update --all about HEAD
- This is the document patch for f0298cf1c6 (revision walker: include a
- detached HEAD in --all - 2009-01-16).
- Even though that commit is about detached HEAD, as Jeff pointed out,
- always adding HEAD in that case may have subtle differences with
- --source or --exclude. So the document mentions nothing about the
- detached-ness.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7800: replace "wc -l" with test_line_count
- Make t7800 easier to debug by capturing output into temporary files and
- using test_line_count to make assertions on those files.
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'da/difftool-dir-diff-fix' into da/t7800-cleanup
- * da/difftool-dir-diff-fix:
- difftool: fix dir-diff index creation when in a subdirectory
- t7800: simplify basic usage test
- Use "test_line_count" instead of "wc -l", use "git -C" instead of a
- subshell, and use test_expect_code when calling difftool. Ease
- debugging by capturing output into temporary files.
- Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Document the --no-gui option in difftool
- Prior to this, the `--no-gui` option was not documented in the manpage.
- This commit introduces this into the manpage
- Signed-off-by: Denton Liu <liu.denton@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: resurrect "strip" as a synonym to "lstrip"
- We forgot that "strip" was introduced at 0571979bd6 ("tag: do not
- show ambiguous tag names as "tags/foo"", 2016-01-25) as part of Git
- 2.8 (and 2.7.1) when we started calling this "lstrip" to make it
- easier to explain the new "rstrip" operation.
- We shouldn't have renamed the existing one; "lstrip" should have
- been a new synonym that means the same thing as "strip". Scripts
- in the wild are surely using the original form already.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- worktree: fix option descriptions for `prune`
- The `verbose` and `expire` options of the `git worktree prune`
- subcommand have wrong descriptions in that they pretend to relate to
- objects. But as the git-worktree(1) correctly states, these options have
- nothing to do with objects but only with worktrees. Fix the description
- accordingly.
- Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- p5302: create repositories for index-pack results explicitly
- Before 7176a314 (index-pack: complain when --stdin is used outside of a
- repo) index-pack silently created a non-existing target directory; now
- the command refuses to work unless it's used against a valid repository.
- That causes p5302 to fail, which relies on the former behavior. Fix it
- by setting up the destinations for its performance tests using git init.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Acked-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: fix git svn authorship switches
- --add-author-from and --use-log-author are for "git svn dcommit",
- not "git svn (init|clone)"
- Signed-off-by: Eric Wong <e@80x24.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: fix bug when printing usage
- "git difftool -h" reports an error:
- fatal: BUG: setup_git_env called without repository
- Defer repository setup so that the help option processing happens before
- the repository is initialized.
- Add tests to ensure that the basic usage works inside and outside of a
- repository.
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- l10n: fr.po: Fix a typo in the French translation
- Signed-off-by: Anthony Ramine <n.oxyde@gmail.com>
- l10n: fr.po: Remove gender specific adjectives
- Signed-off-by: Joachim Jablon <ewjoachim@gmail.com>
- Reviewed-by: Jean-Noel Avila <jn.avila@free.fr>
- l10n: fr.po: Fix typos
- Reviewed-by: Jean-Noel Avila <jn.avila@free.fr>
- Signed-off-by: Joachim Jablon <ewjoachim@gmail.com>
- reset: add an example of how to split a commit into two
- It is often useful to break a commit into multiple parts that are more
- logical separations. This can be tricky to learn how to do without the
- brute-force method if re-writing code or commit messages from scratch.
- Add a section to the git-reset documentation which shows an example
- process for how to use git add -p and git commit -c HEAD@{1} to
- interactively break a commit apart and re-use the original commit
- message as a starting point when making the new commit message.
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: recognize more long-options
- Command completion only recognizes a subset of the available options for
- the various git commands. The set of recognized options needs to balance
- between having all useful options and to not clutter the terminal.
- This commit adds all long-options that are mentioned in the man-page
- synopsis of the respective git command. Possibly dangerous options are
- not included in this set, to avoid accidental data loss. The added
- options are:
- - apply: --recount --directory=
- - archive: --output
- - branch: --column --no-column --sort= --points-at
- - clone: --no-single-branch --shallow-submodules
- - commit: --patch --short --date --allow-empty
- - describe: --first-parent
- - fetch, pull: --unshallow --update-shallow
- - fsck: --name-objects
- - grep: --break --heading --show-function --function-context
- --untracked --no-index
- - mergetool: --prompt --no-prompt
- - reset: --keep
- - revert: --strategy= --strategy-option=
- - shortlog: --email
- - tag: --merged --no-merged --create-reflog
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Helped-by: Johannes Sixt <j6t@kdbg.org>
- Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: teach remote subcommands to complete options
- Git-remote needs to complete remote names, its subcommands, and options
- thereof. In addition to the existing subcommand and remote name
- completion, do also complete the options
- - add: --track --master --fetch --tags --no-tags --mirror=
- - set-url: --push --add --delete
- - get-url: --push --all
- - prune: --dry-run
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: teach replace to complete options
- Git-replace needs to complete references and its own options. In
- addition to the existing references completions, do also complete the
- options --edit --graft --format= --list --delete.
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: teach ls-remote to complete options
- ls-remote needs to complete remote names and its own options. In
- addition to the existing remote name completions, do also complete
- the options --heads, --tags, --refs, --get-url, and --symref.
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: improve bash completion for git-add
- Command completion for git-add did not recognize some long-options.
- This commits adds completion for all long-options that are mentioned in
- the man-page synopsis. In addition, if the user specified `--update` or
- `-u`, path completion will only suggest modified tracked files.
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: add subcommand completion for rerere
- Managing recorded resolutions requires command-line usage of git-rerere.
- Added subcommand completion for rerere and path completion for its
- subcommand forget.
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: teach submodule subcommands to complete options
- Each submodule subcommand has specific long-options. Therefore, teach
- bash completion to support option completion based on the current
- subcommand. All long-options that are mentioned in the man-page synopsis
- are added.
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: cache the path to the repository
- After the previous changes in this series there are only a handful of
- $(__gitdir) command substitutions left in the completion script, but
- there is still a bit of room for improvements:
- 1. The command substitution involves the forking of a subshell,
- which has considerable overhead on some platforms.
- 2. There are a few cases, where this command substitution is
- executed more than once during a single completion, which means
- multiple subshells and possibly multiple 'git rev-parse'
- executions. __gitdir() is invoked twice while completing refs
- for e.g. 'git log', 'git rebase', 'gitk', or while completing
- remote refs for 'git fetch' or 'git push'.
- Both of these points can be addressed by using the
- __git_find_repo_path() helper function introduced in the previous
- commit:
- 1. __git_find_repo_path() stores the path to the repository in a
- variable instead of printing it, so the command substitution
- around the function can be avoided. Or rather: the command
- substitution should be avoided to make the new value of the
- variable set inside the function visible to the callers.
- (Yes, there is now a command substitution inside
- __git_find_repo_path() around each 'git rev-parse', but that's
- executed only if necessary, and only once per completion, see
- point 2. below.)
- 2. $__git_repo_path, the variable holding the path to the
- repository, is declared local in the toplevel completion
- functions __git_main() and __gitk_main(). Thus, once set, the
- path is visible in all completion functions, including all
- subsequent calls to __git_find_repo_path(), meaning that they
- wouldn't have to re-discover the path to the repository.
- So call __git_find_repo_path() and use $__git_repo_path instead of the
- $(__gitdir) command substitution to access paths in the .git
- directory. Turn tests checking __gitdir()'s repository discovery into
- tests of __git_find_repo_path() such that only the tested function
- changes but the expected results don't, ensuring that repo discovery
- keeps working as it did before.
- As __gitdir() is not used anymore in the completion script, mark it as
- deprecated and direct users' attention to __git_find_repo_path() and
- $__git_repo_path. Yet keep four __gitdir() tests to ensure that it
- handles success and failure of __git_find_repo_path() and that it
- still handles its optional remote argument, because users' custom
- completion scriptlets might depend on it.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: extract repository discovery from __gitdir()
- To prepare for caching the path to the repository in the following
- commit, extract the repository discovering part of __gitdir() into the
- __git_find_repo_path() helper function, which stores the found path in
- the $__git_repo_path variable instead of printing it. Make __gitdir()
- a wrapper around this new function. Declare $__git_repo_path local in
- the toplevel completion functions __git_main() and __gitk_main() to
- ensure that it never leaks into the environment and influences
- subsequent completions (though this isn't necessary right now, as
- __gitdir() is still only executed in subshells, but will matter for
- the following commit).
- Adjust tests checking __gitdir() or any other completion function
- calling __gitdir() to perform those checks in a subshell to prevent
- $__git_repo_path from leaking into the test environment. Otherwise
- leave the tests unchanged to demonstrate that this change doesn't
- alter __gitdir()'s behavior.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: don't guard git executions with __gitdir()
- Three completion functions, namely __git_index_files(), __git_heads()
- and __git_tags(), first run __gitdir() and check that the path it
- outputs exists, i.e. that there is a git repository, and run a git
- command only if there is one.
- After the previous changes in this series there are no further uses of
- __gitdir()'s output in these functions besides those checks. And
- those checks are unnecessary, because we can just execute those git
- commands outside of a repository and let them error out. We don't
- perform such a check in other places either.
- Remove this check and the __gitdir() call from these functions,
- sparing the fork()+exec() overhead of the command substitution and the
- potential 'git rev-parse' execution.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: consolidate silencing errors from git commands
- Outputting error messages during completion is bad: they disrupt the
- command line, can't be deleted, and the user is forced to Ctrl-C and
- start over most of the time. We already silence stderr of many git
- commands in our Bash completion script, but there are still some in
- there that can spew error messages when something goes wrong.
- We could add the missing stderr redirections to all the remaining
- places, but instead let's leverage that git commands are now executed
- through the previously introduced __git() wrapper function, and
- redirect standard error to /dev/null only in that function. This way
- we need only one redirection to take care of errors from almost all
- git commands. Redirecting standard error of the __git() wrapper
- function thus became redundant, remove them.
- The exceptions, i.e. the repo-independent git executions and those in
- the __gitdir() function that don't go through __git() already have
- their standard error silenced.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: don't use __gitdir() for git commands
- Several completion functions contain the following pattern to run git
- commands respecting the path to the repository specified on the
- command line:
- git --git-dir="$(__gitdir)" <cmd> <options>
- This imposes the overhead of fork()ing a subshell for the command
- substitution and potentially fork()+exec()ing 'git rev-parse' inside
- __gitdir().
- Now, if neither '--gitdir=<path>' nor '-C <path>' options are
- specified on the command line, then those git commands are perfectly
- capable to discover the repository on their own. If either one or
- both of those options are specified on the command line, then, again,
- the git commands could discover the repository, if we pass them all of
- those options from the command line.
- This means we don't have to run __gitdir() at all for git commands and
- can spare its fork()+exec() overhead.
- Use Bash parameter expansions to check the $__git_dir variable and
- $__git_C_args array and to assemble the appropriate '--git-dir=<path>'
- and '-C <path>' options if either one or both are present on the
- command line. These parameter expansions are, however, rather long,
- so instead of changing all git executions and make already long lines
- even longer, encapsulate running git with '--git-dir=<path> -C <path>'
- options into the new __git() wrapper function. Furthermore, this
- wrapper function will also enable us to silence error messages from
- git commands uniformly in one place in a later commit.
- There's one tricky case, though: in __git_refs() local refs are listed
- with 'git for-each-ref', where "local" is not necessarily the
- repository we are currently in, but it might mean a remote repository
- in the filesystem (e.g. listing refs for 'git fetch /some/other/repo
- <TAB>'). Use one-shot variable assignment to override $__git_dir with
- the path of the repository where the refs should come from. Although
- one-shot variable assignments in front of shell functions are to be
- avoided in our scripts in general, in the Bash completion script we
- can do that safely.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: respect 'git -C <path>'
- 'git -C <path>' option(s) on the command line should be taken into
- account during completion, because
- - like '--git-dir=<path>', it can lead us to a different repository,
- - a few git commands executed in the completion script do care about
- in which directory they are executed, and
- - the command for which we are providing completion might care about
- in which directory it will be executed.
- However, unlike '--git-dir=<path>', the '-C <path>' option can be
- specified multiple times and their effect is cumulative, so we can't
- just store a single '<path>' in a variable. Nor can we simply
- concatenate a path from '-C <path1> -C <path2> ...', because e.g. (in
- an arguably pathological corner case) a relative path might be
- followed by an absolute path.
- Instead, store all '-C <path>' options word by word in the
- $__git_C_args array in the main git completion function, and pass this
- array, if present, to 'git rev-parse --absolute-git-dir' when
- discovering the repository in __gitdir(), and let it take care of
- multiple options, relative paths, absolute paths and everything.
- Also pass all '-C <path> options via the $__git_C_args array to those
- git executions which require a worktree and for which it matters from
- which directory they are executed from. There are only three such
- cases:
- - 'git diff-index' and 'git ls-files' in __git_ls_files_helper()
- used for git-aware filename completion, and
- - the 'git ls-tree' used for completing the 'ref:path' notation.
- The other git commands executed in the completion script don't need
- these '-C <path>' options, because __gitdir() already took those
- options into account. It would not hurt them, either, but let's not
- induce unnecessary code churn.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rev-parse: add '--absolute-git-dir' option
- The output of 'git rev-parse --git-dir' can be either a relative or an
- absolute path, depending on whether the current working directory is
- at the top of the worktree or the .git directory or not, or how the
- path to the repository is specified via the '--git-dir=<path>' option
- or the $GIT_DIR environment variable. And if that output is a
- relative path, then it is relative to the directory where any 'git
- -C <path>' options might have led us.
- This doesn't matter at all for regular scripts, because the git
- wrapper automatically takes care of changing directories according to
- the '-C <path>' options, and the scripts can then simply follow any
- path returned by 'git rev-parse --git-dir', even if it's a relative
- path.
- Our Bash completion script, however, is unique in that it must run
- directly in the user's interactive shell environment. This means that
- it's not executed through the git wrapper and would have to take care
- of any '-C <path> options on its own, and it can't just change
- directories as it pleases. Consequently, adding support for taking
- any '-C <path>' options on the command line into account during
- completion turned out to be considerably more difficult, error prone
- and required more subshells and git processes when it had to cope with
- a relative path to the .git directory.
- Help this rather special use case and teach 'git rev-parse' a new
- '--absolute-git-dir' option which always outputs a canonicalized
- absolute path to the .git directory, regardless of whether the path is
- discovered automatically or is specified via $GIT_DIR or 'git
- --git-dir=<path>'.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: fix completion after 'git -C <path>'
- The main completion function finds the name of the git command by
- iterating through all the words on the command line in search for the
- first non-option-looking word. As it is not aware of 'git -C's
- mandatory path argument, if the '-C <path>' option is present, 'path'
- will be the first such word and it will be mistaken for a git command.
- This breaks completion in various ways:
- - If 'path' happens to match one of the commands supported by the
- completion script, then options of that command will be offered.
- - If 'path' doesn't match a supported command and doesn't contain any
- characters not allowed in Bash identifier names, then the
- completion script does basically nothing and Bash in turn falls
- back to filename completion for all subsequent words.
- - Otherwise, if 'path' does contain such an unallowed character, then
- it leads to a more or less ugly error message in the middle of the
- command line. The standard '/' directory separator is such a
- character, and it happens to trigger one of the uglier errors:
- $ git -C some/path <TAB>sh.exe": declare: `_git_some/path': not a valid identifier
- error: invalid key: alias.some/path
- Fix this by skipping 'git -C's mandatory path argument while iterating
- over the words on the command line. Extend the relevant test with
- this case and, while at it, with cases that needed similar treatment
- in the past ('--git-dir', '-c', '--work-tree' and '--namespace').
- Additionally, silence the standard error of the 'declare' builtins
- looking for the completion function associated with the git command
- and of the 'git config' query for the aliased command. So if git ever
- learns a new option with a mandatory argument in the future, then,
- though the completion script will again misbehave, at least the
- command line will not be utterly disrupted by those error messages.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: don't offer commands when 'git --opt' needs an argument
- The main git options '--git-dir', '-c', '-C', '--worktree' and
- '--namespace' require an argument, but attempting completion right
- after them lists git commands.
- Don't offer anything right after these options, thus let Bash fall
- back to filename completion, because
- - the three options '--git-dir', '-C' and '--worktree' do actually
- require a path argument, and
- - we don't complete the required argument of '-c' and '--namespace',
- and in that case the "standard" behavior of our completion script
- is to not offer anything, but fall back to filename completion.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: list short refs from a remote given as a URL
- e832f5c09680 (completion: avoid ls-remote in certain scenarios,
- 2013-05-28) turned a 'git ls-remote <remote>' query into a 'git
- for-each-ref refs/remotes/<remote>/' to improve responsiveness of
- remote refs completion by avoiding potential network communication.
- However, it inadvertently made impossible to complete short refs from
- a remote given as a URL, e.g. 'git fetch git://server.com/repo.git
- <TAB>', because there is, of course, no such thing as
- 'refs/remotes/git://server.com/repo.git'.
- Since the previous commit we tell apart configured remotes, i.e. those
- that can have a hierarchy under 'refs/remotes/', from others that
- don't, including remotes given as URL, so we know when we can't use
- the faster 'git for-each-ref'-based approach.
- Resurrect the old, pre-e832f5c09680 'git ls-remote'-based code for the
- latter case to support listing short refs from remotes given as a URL.
- The code is slightly updated from the original to
- - take into account the path to the repository given on the command
- line (if any), and
- - omit 'ORIG_HEAD' from the query, as 'git ls-remote' will never
- list it anyway.
- When the remote given to __git_refs() doesn't exist, then it will be
- handled by this resurrected 'git ls-remote' query. This code path
- doesn't list 'HEAD' unconditionally, which has the nice side effect of
- fixing two more expected test failures.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: don't list 'HEAD' when trying refs completion outside of a repo
- When refs completion is attempted while not in a git repository, the
- completion script offers 'HEAD' erroneously.
- Check early in __git_refs() that there is either a repository or a
- remote to work on, and return early if neither is given.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: list refs from remote when remote's name matches a directory
- If the remote given to __git_refs() happens to match both the name of
- a configured remote and the name of a directory in the current working
- directory, then that directory is assumed to be a git repository, and
- listing refs from that directory will be attempted. This is wrong,
- because in such a situation git commands (e.g. 'git fetch|pull|push
- <remote>' whom these refs will eventually be passed to) give
- precedence to the configured remote. Therefore, __git_refs() should
- list refs from the configured remote as well.
- Add the helper function __git_is_configured_remote() that checks
- whether its argument matches the name of a configured remote. Use
- this helper to decide how to handle the remote passed to __git_refs().
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: respect 'git --git-dir=<path>' when listing remote refs
- In __git_refs() the git commands listing refs, both short and full,
- from a given remote repository are run without giving them the path to
- the git repository which might have been specified on the command line
- via 'git --git-dir=<path>'. This is bad, those git commands should
- access the 'refs/remotes/<remote>/' hierarchy or the remote and
- credentials configuration in that specified repository.
- Use the __gitdir() helper only to find the path to the .git directory
- and pass the resulting path to the 'git ls-remote' and 'for-each-ref'
- executions that list remote refs. While modifying that 'for-each-ref'
- line, remove the superfluous disambiguating doubledash.
- Don't use __gitdir() to check that the given remote is on the file
- system: basically it performs only a single if statement for us at the
- considerable cost of fork()ing a subshell for a command substitution.
- We are better off to perform all the necessary checks of the remote in
- __git_refs().
- Though __git_refs() was the last remaining callsite that passed a
- remote to __gitdir(), don't delete __gitdir()'s remote-handling part
- yet, just in case some users' custom completion scriptlets depend on
- it.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: fix most spots not respecting 'git --git-dir=<path>'
- The completion script already respects the path to the repository
- specified on the command line most of the time, here we add the
- necessary '--git-dir=$(__gitdir)' options to most of the places where
- git was executed without it. The exceptions where said option is not
- added are the git invocations:
- - in __git_refs() which are non-trivial and will be the subject of
- the following patch,
- - getting the list of git commands, merge strategies and archive
- formats, because these are independent from the repository and
- thus don't need it, and
- - the 'git rev-parse --git-dir' in __gitdir() itself.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: ensure that the repository path given on the command line exists
- The __gitdir() helper function prints the path to the git repository
- to its stdout or stays silent and returns with error when it can't
- find a repository or when the repository given via $GIT_DIR doesn't
- exist.
- This is not the case, however, when the path in $__git_dir, i.e. the
- path to the repository specified on the command line via 'git
- --git-dir=<path>', doesn't exist: __gitdir() still outputs it as if it
- were a real existing repository, making some completion functions
- believe that they operate on an existing repository.
- Check that the path in $__git_dir exists and return with error without
- printing anything to stdout if it doesn't.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion tests: add tests for the __git_refs() helper function
- Check how __git_refs() lists refs in different scenarios, i.e.
- - short and full refs,
- - from a local or from a remote repository,
- - remote specified via path, name or URL,
- - with or without a repository specified on the command line,
- - non-existing remote,
- - unique remote branches for 'git checkout's tracking DWIMery,
- - not in a git repository, and
- - interesting combinations of the above.
- Seven of these tests expect failure, mostly demonstrating bugs related
- to listing refs from a remote repository:
- - ignoring the repository specified on the command line (2 tests),
- - listing refs from the wrong place when the name of a configured
- remote happens to match a directory,
- - listing only 'HEAD' but no short refs from a remote given as URL,
- - listing 'HEAD' even from non-existing remotes (2 tests), and
- - listing 'HEAD' when not in a repository.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion tests: check __gitdir()'s output in the error cases
- The __gitdir() helper function shouldn't output anything if not in a
- git repository. The relevant tests only checked its error code, so
- extend them to ensure that there's no output.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion tests: consolidate getting path of current working directory
- Some tests of the __gitdir() helper function use the $TRASH_DIRECTORY
- variable in direct path comparisons. In general this should be
- avoided, because it might contain symbolic links. There happens to be
- no issues with this here, however, because those tests use
- $TRASH_DIRECTORY both for specifying the expected result and for
- specifying input which in turn is just 'echo'ed verbatim.
- Other __gitdir() tests ask for the path of the trash directory by
- running $(pwd -P) in each test, sometimes even twice in a single test.
- Run $(pwd) only once at the beginning of the test script to store the
- path of the trash directory in a variable, and use that variable in
- all __gitdir() tests.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion tests: make the $cur variable local to the test helper functions
- The test helper functions test_gitcomp() and test_gitcomp_nl() leak
- the $cur variable into the test environment. Since this variable has
- a special role in the Bash completion script (it holds the word
- currently being completed) it influences the behavior of most
- completion functions and thus this leakage could interfere with
- subsequent tests. Although there are no such issues in the current
- tests, early versions of the new tests that will be added later in
- this series suffered because of this.
- It's better to play safe and declare $cur local in those test helper
- functions. 'local' is bashism, of course, but the tests of the Bash
- completion script are run under Bash anyway, and there are already
- other variables declared local in this test script.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion tests: don't add test cruft to the test repository
- While preparing commits, three tests added newly created files to the
- index using 'git add .', which added not only the files in question
- but leftover test cruft from previous tests like the files 'expected'
- and 'actual' as well. Luckily, this had no effect on the tests'
- correctness.
- Add only the files we are actually interested in.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: improve __git_refs()'s in-code documentation
- That "first argument is passed to __gitdir()" statement in particular
- is not really helpful, and after this series it won't be the case
- anyway.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)
- Generate po/git.pot from v2.12.0-rc0 for git v2.12.0 l10n round 1.
- Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
- Merge branch 'master' of git://github.com/git-l10n/git-po
- * 'master' of git://github.com/git-l10n/git-po:
- l10n: bg: Updated Bulgarian translation (2913t+0f+0u)
- l10n: fixes to Catalan translation
- l10n: zh_CN: review for git v2.11.0 l10n
- l10n: New Catalan translation maintainer
- Git 2.12-rc0
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'cw/log-updates-for-all-refs-really'
- The "core.logAllRefUpdates" that used to be boolean has been
- enhanced to take 'always' as well, to record ref updates to refs
- other than the ones that are expected to be updated (i.e. branches,
- remote-tracking branches and notes).
- * cw/log-updates-for-all-refs-really:
- doc: add note about ignoring '--no-create-reflog'
- update-ref: add test cases for bare repository
- refs: add option core.logAllRefUpdates = always
- config: add markup to core.logAllRefUpdates doc
- Merge branch 'pl/complete-diff-submodule-diff'
- The command line completion (in contrib/) learned that
- "git diff --submodule=" can take "diff" as a recently added option.
- * pl/complete-diff-submodule-diff:
- Completion: Add support for --submodule=diff
- Merge branch 'rs/object-id'
- "uchar [40]" to "struct object_id" conversion continues.
- * rs/object-id:
- checkout: convert post_checkout_hook() to struct object_id
- use oidcpy() for copying hashes between instances of struct object_id
- use oid_to_hex_r() for converting struct object_id hashes to hex strings
- Merge branch 'js/re-running-failed-tests'
- "make -C t failed" will now run only the tests that failed in the
- previous run. This is usable only when prove is not use, and gives
- a useless error message when run after "make clean", but otherwise
- is serviceable.
- * js/re-running-failed-tests:
- t/Makefile: add a rule to re-run previously-failed tests
- Merge branch 'sb/submodule-update-initial-runs-custom-script'
- The user can specify a custom update method that is run when
- "submodule update" updates an already checked out submodule. This
- was ignored when checking the submodule out for the first time and
- we instead always just checked out the commit that is bound to the
- path in the superproject's index.
- * sb/submodule-update-initial-runs-custom-script:
- submodule update: run custom update script for initial populating as well
- Merge branch 'sb/submodule-recursive-absorb'
- When a submodule "A", which has another submodule "B" nested within
- it, is "absorbed" into the top-level superproject, the inner
- submodule "B" used to be left in a strange state. The logic to
- adjust the .git pointers in these submodules has been corrected.
- * sb/submodule-recursive-absorb:
- submodule absorbing: fix worktree/gitdir pointers recursively for non-moves
- cache.h: expose the dying procedure for reading gitlinks
- setup: add gentle version of resolve_git_dir
- Merge branch 'sb/unpack-trees-super-prefix'
- "git read-tree" and its underlying unpack_trees() machinery learned
- to report problematic paths prefixed with the --super-prefix option.
- * sb/unpack-trees-super-prefix:
- unpack-trees: support super-prefix option
- t1001: modernize style
- t1000: modernize style
- read-tree: use OPT_BOOL instead of OPT_SET_INT
- Sync with v2.11.1
- * maint:
- Git 2.11.1
- Ninth batch for 2.12; almost ready for -rc0
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'nd/log-graph-configurable-colors'
- Some people feel the default set of colors used by "git log --graph"
- rather limiting. A mechanism to customize the set of colors has
- been introduced.
- * nd/log-graph-configurable-colors:
- document behavior of empty color name
- color_parse_mem: allow empty color spec
- log --graph: customize the graph lines with config log.graphColors
- color.c: trim leading spaces in color_parse_mem()
- color.c: fix color_parse_mem() with value_len == 0
- Merge branch 'ep/commit-static-buf-cleanup'
- Code clean-up.
- * ep/commit-static-buf-cleanup:
- builtin/commit.c: switch to strbuf, instead of snprintf()
- builtin/commit.c: remove the PATH_MAX limitation via dynamic allocation
- Merge branch 'bc/use-asciidoctor-opt'
- Asciidoctor, an alternative reimplementation of AsciiDoc, still
- needs some changes to work with documents meant to be formatted
- with AsciiDoc. "make USE_ASCIIDOCTOR=YesPlease" to use it out of
- the box to document our pages is getting closer to reality.
- * bc/use-asciidoctor-opt:
- Documentation: implement linkgit macro for Asciidoctor
- Makefile: add a knob to enable the use of Asciidoctor
- Documentation: move dblatex arguments into variable
- Documentation: add XSLT to fix DocBook for Texinfo
- Documentation: sort sources for gitman.texi
- Documentation: remove unneeded argument in cat-texi.perl
- Documentation: modernize cat-texi.perl
- Documentation: fix warning in cat-texi.perl
- Merge branch 'sg/mailmap-self'
- * sg/mailmap-self:
- .mailmap: update Gábor Szeder's email address
- Merge branch 'js/mingw-hooks-with-exe-suffix'
- Names of the various hook scripts must be spelled exactly, but on
- Windows, an .exe binary must be named with .exe suffix; notice
- $GIT_DIR/hooks/<hookname>.exe as a valid <hookname> hook.
- * js/mingw-hooks-with-exe-suffix:
- mingw: allow hooks to be .exe files
- Merge branch 'rs/receive-pack-cleanup'
- Code clean-up.
- * rs/receive-pack-cleanup:
- receive-pack: call string_list_clear() unconditionally
- Merge branch 'mm/reset-facl-before-umask-test'
- Test tweaks for those who have default ACL in their git source tree
- that interfere with the umask test.
- * mm/reset-facl-before-umask-test:
- t0001: don't let a default ACL interfere with the umask test
- Merge branch 'hv/mingw-help-is-executable'
- "git help" enumerates executable files in $PATH; the implementation
- of "is this file executable?" on Windows has been optimized.
- * hv/mingw-help-is-executable:
- help: improve is_executable() on Windows
- Merge branch 'gv/mingw-p4-mapuser'
- "git p4" did not work well with multiple git-p4.mapUser entries on
- Windows.
- * gv/mingw-p4-mapuser:
- git-p4: fix git-p4.mapUser on Windows
- Merge branch 'rs/absolute-pathdup'
- Code cleanup.
- * rs/absolute-pathdup:
- use absolute_pathdup()
- abspath: add absolute_pathdup()
- Merge branch 'js/unzip-in-usr-bin-workaround'
- Test tweak for FreeBSD where /usr/bin/unzip is unsuitable to run
- our tests but /usr/local/bin/unzip is usable.
- * js/unzip-in-usr-bin-workaround:
- test-lib: on FreeBSD, look for unzip(1) in /usr/local/bin/
- Merge branch 'cw/doc-sign-off'
- Doc update.
- * cw/doc-sign-off:
- doc: clarify distinction between sign-off and pgp-signing
- Merge branch 'js/status-pre-rebase-i'
- After starting "git rebase -i", which first opens the user's editor
- to edit the series of patches to apply, but before saving the
- contents of that file, "git status" failed to show the current
- state (i.e. you are in an interactive rebase session, but you have
- applied no steps yet) correctly.
- * js/status-pre-rebase-i:
- status: be prepared for not-yet-started interactive rebase
- Merge branch 'js/retire-relink'
- Cruft removal.
- * js/retire-relink:
- relink: really remove the command
- relink: retire the command
- Merge branch 'sb/submodule-add-force'
- "git submodule add" used to be confused and refused to add a
- locally created repository; users can now use "--force" option
- to add them.
- * sb/submodule-add-force:
- submodule add: extend force flag to add existing repos
- Git 2.11.1
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'ws/request-pull-code-cleanup' into maint
- Code clean-up.
- * ws/request-pull-code-cleanup:
- request-pull: drop old USAGE stuff
- Merge branch 'jk/execv-dashed-external' into maint
- Typing ^C to pager, which usually does not kill it, killed Git and
- took the pager down as a collateral damage in certain process-tree
- structure. This has been fixed.
- * jk/execv-dashed-external:
- execv_dashed_external: wait for child on signal death
- execv_dashed_external: stop exiting with negative code
- execv_dashed_external: use child_process struct
- document behavior of empty color name
- Commit 55cccf4bb (color_parse_mem: allow empty color spec,
- 2017-02-01) clearly defined the behavior of an empty color
- config variable. Let's document that, and give a hint about
- why it might be useful.
- It's important not to say that it makes the item uncolored,
- because it doesn't. It just sets no attributes, which means
- that any previous attributes continue to take effect.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: add note about ignoring '--no-create-reflog'
- The commands git-branch and git-tag accept the '--create-reflog'
- option, and create reflog even when core.logallrefupdates
- configuration is explicitly set not to.
- On the other hand, the negated form '--no-create-reflog' is accepted
- as a valid option but has no effect (other than overriding an
- earlier '--create-reflog' on the command line). This silent noop may
- puzzle users. To communicate that this is a known limitation, add a
- short note in the manuals for git-branch and git-tag.
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Helped-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: add completion for --recurse-submodules=only
- Command completion for 'git-push --recurse-submodules' already knows to
- complete some modes. However, the recently added mode 'only' is missing.
- Adding 'only' to the recognized modes completes the list of non-trivial
- modes.
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: add doc for git-push --recurse-submodules=only
- Add documentation for the `--recurse-submodules=only` option of
- git-push. The feature was added in commit 225e8bf (add option to
- push only submodules).
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: reformat git_attr_set_direction() function
- Move the 'git_attr_set_direction()' up to be closer to the variables
- that it modifies as well as a small formatting by renaming the variable
- 'new' to 'new_direction' so that it is more descriptive.
- Update the comment about how 'direction' is used to read the state of
- the world. It should be noted that callers of
- 'git_attr_set_direction()' should ensure that other threads are not
- making calls into the attribute system until after the call to
- 'git_attr_set_direction()' completes. This function essentially acts as
- reset button for the attribute system and should be handled with care.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: push the bare repo check into read_attr()
- Push the bare repository check into the 'read_attr()' function. This
- avoids needing to have extra logic which creates an empty stack frame
- when inside a bare repo as a similar bit of logic already exists in the
- 'read_attr()' function.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: store attribute stack in attr_check structure
- The last big hurdle towards a thread-safe API for the attribute system
- is the reliance on a global attribute stack that is modified during each
- call into the attribute system.
- This patch removes this global stack and instead a stack is stored
- locally in each attr_check instance. This opens up the opportunity for
- future optimizations to customize the attribute stack for the attributes
- that a particular attr_check struct is interested in.
- One caveat with pushing the attribute stack into the attr_check
- structure is that the attribute system now needs to keep track of all
- active attr_check instances. Due to the direction mechanism the stack
- needs to be dropped when the direction is switched. In order to ensure
- correctness when the direction is changed the attribute system needs to
- iterate through all active attr_check instances and drop each of their
- stacks.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: tighten const correctness with git_attr and match_attr
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: remove maybe-real, maybe-macro from git_attr
- Whether or not a git attribute is real or a macro isn't a property of
- the attribute but rather it depends on the attribute stack (which
- .gitattribute files were read).
- This patch removes the 'maybe_real' and 'maybe_macro' fields in a
- git_attr and instead adds the 'macro' field to a attr_check_item. The
- 'macro' indicates (if non-NULL) that a particular attribute is a macro
- for the given attribute stack. It's populated, through a quick scan of
- the attribute stack, with the match_attr that corresponds to the macro's
- definition. This way the attribute stack only needs to be scanned a
- single time prior to attribute collection instead of each time a macro
- needs to be expanded.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: eliminate global check_all_attr array
- Currently there is a reliance on 'check_all_attr' which is a global
- array of 'attr_check_item' items which is used to store the value of
- each attribute during the collection process.
- This patch eliminates this global and instead creates an array per
- 'attr_check' instance which is then used in the attribute collection
- process. This brings the attribute system one step closer to being
- thread-safe.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: use hashmap for attribute dictionary
- The current implementation of the attribute dictionary uses a custom
- hashtable. This modernizes the dictionary by converting it to the builtin
- 'hashmap' structure.
- Also, in order to enable a threaded API in the future add an
- accompanying mutex which must be acquired prior to accessing the
- dictionary of interned attributes.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: change validity check for attribute names to use positive logic
- Convert 'invalid_attr_name()' to 'attr_name_valid()' and use positive
- logic for the return value. In addition create a helper function that
- prints out an error message when an invalid attribute name is used.
- We could later update the message to exactly spell out what the
- rules for a good attribute name are, etc.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: pass struct attr_check to collect_some_attrs
- The old callchain used to take an array of attr_check_item items.
- Instead pass the 'attr_check' container object to 'collect_some_attrs()'
- and access the fields in the data structure directly.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: retire git_check_attrs() API
- Since nobody uses the old API, make it file-scope static, and update
- the documentation to describe the new API.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: convert git_check_attrs() callers to use the new API
- The remaining callers are all simple "I have N attributes I am
- interested in. I'll ask about them with various paths one by one".
- After this step, no caller to git_check_attrs() remains. After
- removing it, we can extend "struct attr_check" struct with data
- that can be used in optimizing the query for the specific N
- attributes it contains.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: convert git_all_attrs() to use "struct attr_check"
- This updates the other two ways the attribute check is done via an
- array of "struct attr_check_item" elements. These two niches
- appear only in "git check-attr".
- * The caller does not know offhand what attributes it wants to ask
- about and cannot use attr_check_initl() to prepare the
- attr_check structure.
- * The caller may not know what attributes it wants to ask at all,
- and instead wants to learn everything that the given path has.
- Such a caller can call attr_check_alloc() to allocate an empty
- attr_check, and then call attr_check_append() to add attribute names
- one by one.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: (re)introduce git_check_attr() and struct attr_check
- A common pattern to check N attributes for many paths is to
- (1) prepare an array A of N attr_check_item items;
- (2) call git_attr() to intern the N attribute names and fill A;
- (3) repeatedly call git_check_attrs() for path with N and A;
- A look-up for these N attributes for a single path P scans the
- entire attr_stack, starting from the .git/info/attributes file and
- then .gitattributes file in the directory the path P is in, going
- upwards to find .gitattributes file found in parent directories.
- An earlier commit 06a604e6 (attr: avoid heavy work when we know the
- specified attr is not defined, 2014-12-28) tried to optimize out
- this scanning for one trivial special case: when the attribute being
- sought is known not to exist, we do not have to scan for it. While
- this may be a cheap and effective heuristic, it would not work well
- when N is (much) more than 1.
- What we would want is a more customized way to skip irrelevant
- entries in the attribute stack, and the definition of irrelevance
- is tied to the set of attributes passed to git_check_attrs() call,
- i.e. the set of attributes being sought. The data necessary for
- this optimization needs to live alongside the set of attributes, but
- a simple array of git_attr_check_elem simply does not have any place
- for that.
- Introduce "struct attr_check" that contains N, the number of
- attributes being sought, and A, the array that holds N
- attr_check_item items, and a function git_check_attr() that
- takes a path P and this structure as its parameters. This structure
- can later be extended to hold extra data necessary for optimization.
- Also, to make it easier to write the first two steps in common
- cases, introduce git_attr_check_initl() helper function, which takes
- a NULL-terminated list of attribute names and initialize this
- structure.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: rename function and struct related to checking attributes
- The traditional API to check attributes is to prepare an N-element
- array of "struct git_attr_check" and pass N and the array to the
- function "git_check_attr()" as arguments.
- In preparation to revamp the API to pass a single structure, in
- which these N elements are held, rename the type used for these
- individual array elements to "struct attr_check_item" and rename
- the function to "git_check_attrs()".
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: outline the future plans by heavily commenting
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: fix a typo
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: add push_stack() helper
- There are too many repetitious "I have this new attr_stack element;
- push it at the top of the stack" sequence. The new helper function
- push_stack() gives us a way to express what is going on at these
- places, and as a side effect, halves the number of times we mention
- the attr_stack global variable.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr: support quoting pathname patterns in C style
- Full pattern must be quoted. So 'pat"t"ern attr' will give exactly
- 'pat"t"ern', not 'pattern'. Also clarify that leading whitespaces are
- not part of the pattern and document comment syntax.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: plug small leak in parse_attr_line()
- If any error is noticed after the match_attr structure is allocated,
- we shouldn't just return NULL from this function.
- Add a fail_return label that frees the allocated structure and
- returns NULL, and consistently jump there when we want to return
- NULL after cleaning up.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: tighten constness around "git_attr" structure
- It holds an interned string, and git_attr_name() is a way to peek
- into it. Make sure the involved pointer types are pointer-to-const.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: simplify macroexpand_one()
- The double-loop wants to do an early return immediately when one
- matching macro is found. Eliminate the extra variable 'a' used for
- that purpose and rewrite the "assign the found item to 'a' to make
- it non-NULL and force the loop(s) to terminate" with a direct return
- from there.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: mark where #if DEBUG ends more clearly
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: complete a sentence in a comment
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: explain the lack of attr-name syntax check in parse_attr()
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: update a stale comment on "struct match_attr"
- When 82dce998 (attr: more matching optimizations from .gitignore,
- 2012-10-15) changed a pointer to a string "*pattern" into an
- embedded "struct pattern" in struct match_attr, it forgot to update
- the comment that describes the structure.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- attr.c: use strchrnul() to scan for one line
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- commit.c: use strchrnul() to scan for one line
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- urlmatch: allow globbing for the URL host part
- The URL matching function computes for two URLs whether they match not.
- The match is performed by splitting up the URL into different parts and
- then doing an exact comparison with the to-be-matched URL.
- The main user of `urlmatch` is the configuration subsystem. It allows to
- set certain configurations based on the URL which is being connected to
- via keys like `http.<url>.*`. A common use case for this is to set
- proxies for only some remotes which match the given URL. Unfortunately,
- having exact matches for all parts of the URL can become quite tedious
- in some setups. Imagine for example a corporate network where there are
- dozens or even hundreds of subdomains, which would have to be configured
- individually.
- Allow users to write an asterisk '*' in place of any 'host' or
- 'subdomain' label as part of the host name. For example,
- "http.https://*.example.com.proxy" sets "http.proxy" for all direct
- subdomains of "https://example.com", e.g. "https://foo.example.com", but
- not "https://foo.bar.example.com".
- Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
- Helped-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- urlmatch: include host in urlmatch ranking
- In order to be able to rank positive matches by `urlmatch`, we inspect
- the path length and user part to decide whether a match is better than
- another match. As all other parts are matched exactly between both URLs,
- this is the correct thing to do right now.
- In the future, though, we want to introduce wild cards for the domain
- part. When doing this, it does not make sense anymore to only compare
- the path lengths. Instead, we also want to compare the domain lengths to
- determine which of both URLs matches the host part more closely.
- Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config
- This environment variable and configuration value allow to
- override the autodetection of plink/tortoiseplink in case that
- Git gets it wrong.
- [jes: wrapped overly-long lines, factored out and changed
- get_ssh_variant() to handle_ssh_variant() to accomodate the
- change from the putty/tortoiseplink variables to
- port_option/needs_batch, adjusted the documentation, free()d
- value obtained from the config.]
- Signed-off-by: Segev Finer <segev208@gmail.com>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git_connect(): factor out SSH variant handling
- We handle plink and tortoiseplink as OpenSSH replacements, by passing
- the correct command-line options when detecting that they are used.
- To let users override that auto-detection (in case Git gets it wrong),
- we need to introduce new code to that end.
- In preparation for this code, let's factor out the SSH variant handling
- into its own function, handle_ssh_variant().
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- color_parse_mem: allow empty color spec
- Prior to c2f41bf52 (color.c: fix color_parse_mem() with
- value_len == 0, 2017-01-19), the empty string was
- interpreted as a color "reset". This was an accidental
- outcome, and that commit turned it into an error.
- However, scripts may pass the empty string as a default
- value to "git config --get-color" to disable color when the
- value is not defined. The git-add--interactive script does
- this. As a result, the script is unusable since c2f41bf52
- unless you have color.diff.plain defined (if it is defined,
- then we don't parse the empty default at all).
- Our test scripts didn't notice the recent breakage because
- they run without a terminal, and thus without color. They
- never hit this code path at all. And nobody noticed the
- original buggy "reset" behavior, because it was effectively
- a noop.
- Let's fix the code to have an empty color name produce an
- empty sequence of color codes. The tests need a few fixups:
- - we'll add a new test in t4026 to cover this case. But
- note that we need to tweak the color() helper. While
- we're there, let's factor out the literal ANSI ESC
- character. Otherwise it makes the diff quite hard to
- read.
- - we'll add a basic sanity-check in t4026 that "git add
- -p" works at all when color is enabled. That would have
- caught this bug, as well as any others that are specific
- to the color code paths.
- - 73c727d69 (log --graph: customize the graph lines with
- config log.graphColors, 2017-01-19) added a test to
- t4202 that checks some "invalid" graph color config.
- Since ",, blue" before yielded only "blue" as valid, and
- now yields "empty, empty, blue", we don't match the
- expected output.
- One way to fix this would be to change the expectation
- to the empty color strings. But that makes the test much
- less interesting, since we show only two graph lines,
- both of which would be colorless.
- Since the empty-string case is now covered by t4026,
- let's remove them entirely here. They're just in the way
- of the primary thing the test is supposed to be
- checking.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- .mailmap: update Gábor Szeder's email address
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Sync with maint
- * maint:
- Ready for 2.11.1
- Ready for 2.11.1
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'sb/in-core-index-doc' into maint
- Documentation and in-code comments updates.
- * sb/in-core-index-doc:
- documentation: retire unfinished documentation
- cache.h: document add_[file_]to_index
- cache.h: document remove_index_entry_at
- cache.h: document index_name_pos
- Merge branch 'js/mingw-isatty' into maint
- An update to a topic that is already in 'master'.
- * js/mingw-isatty:
- mingw: follow-up to "replace isatty() hack"
- Merge branch 'jk/coding-guidelines-update' into maint
- Developer doc update.
- * jk/coding-guidelines-update:
- CodingGuidelines: clarify multi-line brace style
- Merge branch 'js/exec-path-coverity-workaround' into maint
- Code cleanup.
- * js/exec-path-coverity-workaround:
- git_exec_path: do not return the result of getenv()
- git_exec_path: avoid Coverity warning about unfree()d result
- Merge branch 'ad/bisect-terms' into maint
- Documentation fix.
- * ad/bisect-terms:
- Documentation/bisect: improve on (bad|new) and (good|bad)
- Merge branch 'jk/grep-e-could-be-extended-beyond-posix' into maint
- Tighten a test to avoid mistaking an extended ERE regexp engine as
- a PRE regexp engine.
- * jk/grep-e-could-be-extended-beyond-posix:
- t7810: avoid assumption about invalid regex syntax
- Merge branch 'km/branch-get-push-while-detached' into maint
- "git <cmd> @{push}" on a detached HEAD used to segfault; it has
- been corrected to error out with a message.
- * km/branch-get-push-while-detached:
- branch_get_push: do not segfault when HEAD is detached
- Merge branch 'jk/rebase-i-squash-count-fix' into maint
- "git rebase -i" with a recent update started showing an incorrect
- count when squashing more than 10 commits.
- * jk/rebase-i-squash-count-fix:
- rebase--interactive: count squash commits above 10 correctly
- Merge branch 'jk/blame-fixes' into maint
- "git blame --porcelain" misidentified the "previous" <commit, path>
- pair (aka "source") when contents came from two or more files.
- * jk/blame-fixes:
- blame: output porcelain "previous" header for each file
- blame: handle --no-abbrev
- blame: fix alignment with --abbrev=40
- Merge branch 'jk/archive-zip-userdiff-config' into maint
- "git archive" did not read the standard configuration files, and
- failed to notice a file that is marked as binary via the userdiff
- driver configuration.
- * jk/archive-zip-userdiff-config:
- archive-zip: load userdiff config
- Merge branch 'dt/disable-bitmap-in-auto-gc' into maint
- It is natural that "git gc --auto" may not attempt to pack
- everything into a single pack, and there is no point in warning
- when the user has configured the system to use the pack bitmap,
- leading to disabling further "gc".
- * dt/disable-bitmap-in-auto-gc:
- repack: die on incremental + write-bitmap-index
- auto gc: don't write bitmaps for incremental repacks
- Merge branch 'nd/config-misc-fixes' into maint
- Leakage of lockfiles in the config subsystem has been fixed.
- * nd/config-misc-fixes:
- config.c: handle lock file in error case in git_config_rename_...
- config.c: rename label unlock_and_out
- config.c: handle error case for fstat() calls
- Merge branch 'jc/abbrev-autoscale-config' into maint
- Recent update to the default abbreviation length that auto-scales
- lacked documentation update, which has been corrected.
- * jc/abbrev-autoscale-config:
- config.abbrev: document the new default that auto-scales
- Merge branch 'mh/fast-import-notes-fix-new' into maint
- "git fast-import" sometimes mishandled while rebalancing notes
- tree, which has been fixed.
- * mh/fast-import-notes-fix-new:
- fast-import: properly fanout notes when tree is imported
- Merge branch 'jc/compression-config' into maint
- Compression setting for producing packfiles were spread across
- three codepaths, one of which did not honor any configuration.
- Unify these so that all of them honor core.compression and
- pack.compression variables the same way.
- * jc/compression-config:
- compression: unify pack.compression configuration parsing
- Merge branch 'ew/svn-fixes' into maint
- Meant eventually for 'maint'.
- * ew/svn-fixes:
- git-svn: document useLogAuthor and addAuthorFrom config keys
- git-svn: allow "0" in SVN path components
- Merge branch 'ls/travis-p4-on-macos' into maint
- Update the definition of the MacOSX test environment used by
- TravisCI.
- * ls/travis-p4-on-macos:
- travis-ci: fix Perforce install on macOS
- Merge branch 'jk/make-tags-find-sources-tweak' into maint
- Update the procedure to generate "tags" for developer support.
- * jk/make-tags-find-sources-tweak:
- Makefile: exclude contrib from FIND_SOURCE_FILES
- Makefile: match shell scripts in FIND_SOURCE_FILES
- Makefile: exclude test cruft from FIND_SOURCE_FILES
- Makefile: reformat FIND_SOURCE_FILES
- Merge branch 'jc/latin-1' into maint
- Some platforms no longer understand "latin-1" that is still seen in
- the wild in e-mail headers; replace them with "iso-8859-1" that is
- more widely known when conversion fails from/to it.
- * jc/latin-1:
- utf8: accept "latin-1" as ISO-8859-1
- utf8: refactor code to decide fallback encoding
- Eighth batch for 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'jk/fsck-connectivity-check-fix'
- "git fsck --connectivity-check" was not working at all.
- * jk/fsck-connectivity-check-fix:
- fsck: lazily load types under --connectivity-only
- fsck: move typename() printing to its own function
- t1450: use "mv -f" within loose object directory
- fsck: check HAS_OBJ more consistently
- fsck: do not fallback "git fsck <bogus>" to "git fsck"
- fsck: tighten error-checks of "git fsck <head>"
- fsck: prepare dummy objects for --connectivity-check
- fsck: report trees as dangling
- t1450: clean up sub-objects in duplicate-entry test
- Merge branch 'js/difftool-builtin'
- Rewrite a scripted porcelain "git difftool" in C.
- * js/difftool-builtin:
- difftool: hack around -Wzero-length-format warning
- difftool: retire the scripted version
- difftool: implement the functionality in the builtin
- difftool: add a skeleton for the upcoming builtin
- Merge branch 'rs/qsort-s'
- A few codepaths had to rely on a global variable when sorting
- elements of an array because sort(3) API does not allow extra data
- to be passed to the comparison function. Use qsort_s() when
- natively available, and a fallback implementation of it when not,
- to eliminate the need, which is a prerequisite for making the
- codepath reentrant.
- * rs/qsort-s:
- ref-filter: use QSORT_S in ref_array_sort()
- string-list: use QSORT_S in string_list_sort()
- perf: add basic sort performance test
- add QSORT_S
- compat: add qsort_s()
- Merge branch 'ls/travis-p4-on-macos'
- Update the definition of the MacOSX test environment used by
- TravisCI.
- * ls/travis-p4-on-macos:
- travis-ci: fix Perforce install on macOS
- Merge branch 'vp/show-ref-verify-head'
- "git show-ref HEAD" used with "--verify" because the user is not
- interested in seeing refs/remotes/origin/HEAD, and used with
- "--head" because the user does not want HEAD to be filtered out,
- i.e. "git show-ref --head --verify HEAD", did not work as expected.
- * vp/show-ref-verify-head:
- show-ref: remove a stale comment
- show-ref: remove dead `if (verify)' check
- show-ref: detect dangling refs under --verify as well
- show-ref: move --quiet handling into show_one()
- show-ref: allow -d to work with --verify
- show-ref: accept HEAD with --verify
- Merge branch 'sb/retire-convert-objects-from-contrib'
- Remove an ancient tool left in contrib/.
- * sb/retire-convert-objects-from-contrib:
- contrib: remove git-convert-objects
- Merge branch 'sb/in-core-index-doc'
- Documentation and in-code comments updates.
- * sb/in-core-index-doc:
- documentation: retire unfinished documentation
- cache.h: document add_[file_]to_index
- cache.h: document remove_index_entry_at
- cache.h: document index_name_pos
- Merge branch 'js/remote-rename-with-half-configured-remote'
- With anticipatory tweaking for remotes defined in ~/.gitconfig
- (e.g. "remote.origin.prune" set to true, even though there may or
- may not actually be "origin" remote defined in a particular Git
- repository), "git remote rename" and other commands misinterpreted
- and behaved as if such a non-existing remote actually existed.
- * js/remote-rename-with-half-configured-remote:
- remote rename: more carefully determine whether a remote is configured
- remote rename: demonstrate a bogus "remote exists" bug
- Merge branch 'jk/clear-delta-base-cache-fix'
- A crashing bug introduced in v2.11 timeframe has been found (it is
- triggerable only in fast-import) and fixed.
- * jk/clear-delta-base-cache-fix:
- clear_delta_base_cache(): don't modify hashmap while iterating
- Merge branch 'st/verify-tag'
- "git tag" and "git verify-tag" learned to put GPG verification
- status in their "--format=<placeholders>" output format.
- * st/verify-tag:
- t/t7004-tag: Add --format specifier tests
- t/t7030-verify-tag: Add --format specifier tests
- builtin/tag: add --format argument for tag -v
- builtin/verify-tag: add --format to verify-tag
- ref-filter: add function to print single ref_array_item
- gpg-interface, tag: add GPG_VERIFY_OMIT_STATUS flag
- Merge branch 'js/mingw-isatty'
- An update to a topic that is already in 'master'.
- * js/mingw-isatty:
- mingw: follow-up to "replace isatty() hack"
- Merge branch 'js/sequencer-i-countdown-3'
- The sequencer machinery has been further enhanced so that a later
- set of patches can start using it to reimplement "rebase -i".
- * js/sequencer-i-countdown-3: (38 commits)
- sequencer (rebase -i): write out the final message
- sequencer (rebase -i): write the progress into files
- sequencer (rebase -i): show the progress
- sequencer (rebase -i): suggest --edit-todo upon unknown command
- sequencer (rebase -i): show only failed cherry-picks' output
- sequencer (rebase -i): show only failed `git commit`'s output
- sequencer: use run_command() directly
- sequencer: update reading author-script
- sequencer (rebase -i): differentiate between comments and 'noop'
- sequencer (rebase -i): implement the 'drop' command
- sequencer (rebase -i): allow rescheduling commands
- sequencer (rebase -i): respect strategy/strategy_opts settings
- sequencer (rebase -i): respect the rebase.autostash setting
- sequencer (rebase -i): run the post-rewrite hook, if needed
- sequencer (rebase -i): record interrupted commits in rewritten, too
- sequencer (rebase -i): copy commit notes at end
- sequencer (rebase -i): set the reflog message consistently
- sequencer (rebase -i): refactor setting the reflog message
- sequencer (rebase -i): allow fast-forwarding for edit/reword
- sequencer (rebase -i): implement the 'reword' command
- ...
- Merge branch 'jk/coding-guidelines-update'
- Developer doc update.
- * jk/coding-guidelines-update:
- CodingGuidelines: clarify multi-line brace style
- Merge branch 'jk/loose-object-fsck'
- "git fsck" inspects loose objects more carefully now.
- * jk/loose-object-fsck:
- fsck: detect trailing garbage in all object types
- fsck: parse loose object paths directly
- sha1_file: add read_loose_object() function
- t1450: test fsck of packed objects
- sha1_file: fix error message for alternate objects
- t1450: refactor loose-object removal
- Merge branch 'js/exec-path-coverity-workaround'
- Code cleanup.
- * js/exec-path-coverity-workaround:
- git_exec_path: do not return the result of getenv()
- git_exec_path: avoid Coverity warning about unfree()d result
- Merge branch 'bw/push-submodule-only'
- "git submodule push" learned "--recurse-submodules=only option to
- push submodules out without pushing the top-level superproject.
- * bw/push-submodule-only:
- push: add option to push only submodules
- submodules: add RECURSE_SUBMODULES_ONLY value
- transport: reformat flag #defines to be more readable
- Merge branch 'jk/vreport-sanitize'
- An error message with an ASCII control character like '\r' in it
- can alter the message to hide its early part, which is problematic
- when a remote side gives such an error message that the local side
- will relay with a "remote: " prefix.
- * jk/vreport-sanitize:
- vreport: sanitize ASCII control chars
- Revert "vreportf: avoid intermediate buffer"
- branch: implement '--format' option
- Implement the '--format' option provided by 'ref-filter'. This lets the
- user list branches as per desired format similar to the implementation
- in 'git for-each-ref'.
- Add tests and documentation for the same.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- branch: use ref-filter printing APIs
- Port branch.c to use ref-filter APIs for printing. This clears out
- most of the code used in branch.c for printing and replaces them with
- calls made to the ref-filter library.
- Introduce build_format() which gets the format required for printing
- of refs. Make amendments to print_ref_list() to reflect these changes.
- The strings included in build_format() may not be safely quoted for
- inclusion (i.e. it might contain '%' which needs to be escaped with an
- additional '%'). Introduce quote_literal_for_format() as a helper
- function which takes a string and returns a version of the string that
- is safely quoted to be used in the for-each-ref format which is built
- in build_format().
- Change calc_maxwidth() to also account for the length of HEAD ref, by
- calling ref-filter:get_head_discription().
- Also change the test in t6040 to reflect the changes.
- Before this patch, all cross-prefix symrefs weren't shortened. Since
- we're using ref-filter APIs, we shorten all symrefs by default. We also
- allow the user to change the format if needed with the introduction of
- the '--format' option in the next patch.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Helped-by: Junio C Hamano <gitster@pobox.com>
- Helped-by: Jeff King <peff@peff.net>
- Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- branch, tag: use porcelain output
- Call ref-filter's setup_ref_filter_porcelain_msg() to enable
- translated messages for the %(upstream:tack) atom. Although branch.c
- doesn't currently use ref-filter's printing API's, this will ensure
- that when it does in the future patches, we do not need to worry about
- translation.
- Written-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: allow porcelain to translate messages in the output
- Introduce setup_ref_filter_porcelain_msg() so that the messages used in
- the atom %(upstream:track) can be translated if needed. By default, keep
- the messages untranslated, which is the right behavior for plumbing
- commands. This is needed as we port branch.c to use ref-filter's
- printing API's.
- Written-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: add an 'rstrip=<N>' option to atoms which deal with refnames
- Complimenting the existing 'lstrip=<N>' option, add an 'rstrip=<N>'
- option which strips `<N>` slash-separated path components from the end
- of the refname (e.g., `%(refname:rstrip=2)` turns `refs/tags/foo` into
- `refs`).
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'
- Currently the 'lstrip=<N>' option only takes a positive value '<N>'
- and strips '<N>' slash-separated path components from the left. Modify
- the 'lstrip' option to also take a negative number '<N>' which would
- strip from the left as necessary and _leave_ behind only 'N'
- slash-separated path components from the right-most end.
- For e.g. %(refname:lstrip=-1) would make 'foo/goo/abc' into 'abc'.
- Add documentation and tests for the same.
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: implement linkgit macro for Asciidoctor
- AsciiDoc uses a configuration file to implement macros like linkgit,
- while Asciidoctor uses Ruby extensions. Implement a Ruby extension that
- implements the linkgit macro for Asciidoctor in the same way that
- asciidoc.conf does for AsciiDoc. Adjust the Makefile to use it by
- default.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- builtin/commit.c: switch to strbuf, instead of snprintf()
- Switch to dynamic allocation with strbuf, so we can avoid dealing
- with magic numbers in the code and reduce the cognitive burden from
- the programmers. The original code is correct, but programmers no
- longer have to count bytes needed for static allocation to know that.
- As a side effect of this change, we also reduce the snprintf()
- calls, that may silently truncate results if the programmer is not
- careful.
- Helped-by: René Scharfe <l.s.r@web.de>
- Helped-by: Junio C Hamano <gitster@pobox.com>
- Helped-by: Jeff King <peff@peff.net>
- Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- urlmatch: split host and port fields in `struct url_info`
- The `url_info` structure contains information about a normalized URL
- with the URL's components being represented by different fields. The
- host and port part though are to be accessed by the same `host` field,
- so that getting the host and/or port separately becomes more involved
- than really necessary.
- To make the port more readily accessible, split up the host and port
- fields. Namely, the `host_len` will not include the port length anymore
- and a new `port_off` field has been added which includes the offset to
- the port, if available.
- The only user of these fields is `url_normalize_1`. This change makes it
- easier later on to treat host and port differently when introducing
- globs for domains.
- Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- urlmatch: enable normalization of URLs with globs
- The `url_normalize` function is used to validate and normalize URLs. As
- such, it does not allow for some special characters to be part of the
- URLs that are to be normalized. As we want to allow using globs in some
- configuration keys making use of URLs, namely `http.<url>.<key>`, but
- still normalize them, we need to somehow enable some additional allowed
- characters.
- To do this without having to change all callers of `url_normalize`,
- where most do not actually want globbing at all, we split off another
- function `url_normalize_1`. This function accepts an additional
- parameter `allow_globs`, which is subsequently called by `url_normalize`
- with `allow_globs=0`.
- As of now, this function is not used with globbing enabled. A caller
- will be added in the following commit.
- Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mailmap: add Patrick Steinhardt's work address
- Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- update-ref: add test cases for bare repository
- The default behavior of update-ref to create reflogs differs in
- repositories with worktree and bare ones. The existing tests cover only
- the behavior of repositories with worktree.
- This commit adds tests that assert the correct behavior in bare
- repositories for update-ref. Two cases are covered:
- - If core.logAllRefUpdates is not set, no reflogs should be created
- - If core.logAllRefUpdates is true, reflogs should be created
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- refs: add option core.logAllRefUpdates = always
- When core.logallrefupdates is true, we only create a new reflog for refs
- that are under certain well-known hierarchies. The reason is that we
- know that some hierarchies (like refs/tags) are not meant to change, and
- that unknown hierarchies might not want reflogs at all (e.g., a
- hypothetical refs/foo might be meant to change often and drop old
- history immediately).
- However, sometimes it is useful to override this decision and simply log
- for all refs, because the safety and audit trail is more important than
- the performance implications of keeping the log around.
- This patch introduces a new "always" mode for the core.logallrefupdates
- option which will log updates to everything under refs/, regardless
- where in the hierarchy it is (we still will not log things like
- ORIG_HEAD and FETCH_HEAD, which are known to be transient).
- Based-on-patch-by: Jeff King <peff@peff.net>
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- l10n: bg: Updated Bulgarian translation (2913t+0f+0u)
- Signed-off-by: Alexander Shopov <ash@kambanaria.org>
- receive-pack: call string_list_clear() unconditionally
- string_list_clear() handles empty lists just fine, so remove the
- redundant check.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Completion: Add support for --submodule=diff
- Teach git-completion.bash about the 'diff' option to 'git diff
- --submodule=', which was added in Git 2.11.
- Signed-off-by: Peter Law <PeterJCLaw@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- checkout: convert post_checkout_hook() to struct object_id
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- use oidcpy() for copying hashes between instances of struct object_id
- Patch generated by Coccinelle and contrib/coccinelle/object_id.cocci.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- use oid_to_hex_r() for converting struct object_id hashes to hex strings
- Patch generated by Coccinelle and contrib/coccinelle/object_id.cocci.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- graph: use SWAP macro
- Exchange the values of graph->columns and graph->new_columns using the
- macro SWAP instead of hand-rolled code. The result is shorter and
- easier to read.
- This transformation was not done by the semantic patch swap.cocci
- because there's an unrelated statement between the second and the last
- step of the exchange, so it didn't match the expected pattern.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- diff: use SWAP macro
- Use the macro SWAP to exchange the value of pairs of variables instead
- of swapping them manually with the help of a temporary variable. The
- resulting code is shorter and easier to read.
- The two cases were not transformed by the semantic patch swap.cocci
- because it's extra careful and handles only cases where the types of all
- variables are the same -- and here we swap two ints and use an unsigned
- temporary variable for that. Nevertheless the conversion is safe, as
- the value range is preserved with and without the patch.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- use SWAP macro
- Apply the semantic patch swap.cocci to convert hand-rolled swaps to use
- the macro SWAP. The resulting code is shorter and easier to read, the
- object code is effectively unchanged.
- The patch for object.c had to be hand-edited in order to preserve the
- comment before the change; Coccinelle tried to eat it for some reason.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- apply: use SWAP macro
- Use the exported macro SWAP instead of the file-scoped macro swap and
- remove the latter's definition.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- add SWAP macro
- Add a macro for exchanging the values of variables. It allows users
- to avoid repetition and takes care of the temporary variable for them.
- It also makes sure that the storage sizes of its two parameters are the
- same. Its memcpy(1) calls are optimized away by current compilers.
- Also add a conservative semantic patch for transforming only swaps of
- variables of the same type.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- merge-recursive: make "CONFLICT (rename/delete)" message show both paths
- The current message printed by "git merge-recursive" for a rename/delete
- conflict is like this:
- CONFLICT (rename/delete): new-path deleted in HEAD and renamed in
- other-branch. Version other-branch of new-path left in tree.
- To be more helpful, the message should show both paths of the rename and
- state that the deletion occurred at the old path, not the new path. So
- change the message to the following format:
- CONFLICT (rename/delete): old-path deleted in HEAD and renamed to
- new-path in other-branch. Version other-branch of new-path left in tree.
- Since this doubles the number of cases in handle_change_delete (modify vs.
- rename), refactor the code to halve the number of cases again by merging the
- cases where o->branch1 has the change and o->branch2 has the delete with the
- cases that are the other way around.
- Also add a simple test of the new conflict message.
- Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t0001: don't let a default ACL interfere with the umask test
- The "init creates a new deep directory (umask vs. shared)" test expects
- the permissions of newly created files to be based on the umask, which
- fails if a default ACL is inherited from the working tree for git. So
- attempt to remove a default ACL if there is one. Same idea as
- 8ed0a740dd42bd0724aebed6e3b07c4ea2a2d5e8. (I guess I'm the only one who
- ever runs the test suite with a default ACL set.)
- Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- config: add markup to core.logAllRefUpdates doc
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git-p4: fix git-p4.mapUser on Windows
- When running git-p4 on Windows, with multiple git-p4.mapUser entries in
- git config - no user mappings are applied to the generated repository.
- Reproduction Steps:
- 1. Add multiple git-p4.mapUser entries to git config on a Windows
- machine
- 2. Attempt to clone a p4 repository
- None of the user mappings will be applied.
- This issue is actually caused by gitConfigList, using split(os.linesep)
- to convert the output of git config --get-all into a list. On Windows,
- os.linesep is equal to '\r\n' - however git.exe returns configuration
- with a line seperator of '\n'.
- This leads to the list returned by gitConfigList containing only one
- element - which contains the full output of git config --get-all in
- string form, which causes problems for the code introduced to
- getUserMapFromPerforceServer in 10d08a149d ("git-p4: map a P4 user to
- Git author name and email address", 2016-03-01)
- This issue should be caught by the test introduced in 10d08a1, however
- would require running on Windows to reproduce.
- Using splitlines solves this issue, by splitting config on all
- typical delimiters ('\n', '\r\n' etc.)
- Signed-off-by: George Vanburgh <gvanburgh@bloomberg.net>
- Reviewed-by: Luke Diamand <luke@diamand.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- help: improve is_executable() on Windows
- On Windows, executables need to have the file extension `.exe`, or they
- are not executables. Hence, to support scripts, Git for Windows also
- looks for a she-bang line by opening the file in question, and executing
- it via the specified script interpreter.
- To figure out whether files in the `PATH` are executable, `git help` has
- code that imitates this behavior. With one exception: it *always* opens
- the files and looks for a she-bang line *or* an `MZ` tell-tale
- (nevermind that files with the magic `MZ` but without file extension
- `.exe` would still not be executable).
- Opening this many files leads to performance problems that are even more
- serious when a virus scanner is running. Therefore, let's change the
- code to look for the file extension `.exe` early, and avoid opening the
- file altogether if we already know that it is executable.
- See the following measurements (in seconds) as an example, where we
- execute a simple program that simply lists the directory contents and
- calls open() on every listed file:
- With virus scanner running (coldcache):
- $ ./a.exe /libexec/git-core/
- before open (git-add.exe): 0.000000
- after open (git-add.exe): 0.412873
- before open (git-annotate.exe): 0.000175
- after open (git-annotate.exe): 0.397925
- before open (git-apply.exe): 0.000243
- after open (git-apply.exe): 0.399996
- before open (git-archive.exe): 0.000147
- after open (git-archive.exe): 0.397783
- before open (git-bisect--helper.exe): 0.000160
- after open (git-bisect--helper.exe): 0.397700
- before open (git-blame.exe): 0.000160
- after open (git-blame.exe): 0.399136
- ...
- With virus scanner running (hotcache):
- $ ./a.exe /libexec/git-core/
- before open (git-add.exe): 0.000000
- after open (git-add.exe): 0.000325
- before open (git-annotate.exe): 0.000229
- after open (git-annotate.exe): 0.000177
- before open (git-apply.exe): 0.000167
- after open (git-apply.exe): 0.000150
- before open (git-archive.exe): 0.000154
- after open (git-archive.exe): 0.000156
- before open (git-bisect--helper.exe): 0.000132
- after open (git-bisect--helper.exe): 0.000180
- before open (git-blame.exe): 0.000718
- after open (git-blame.exe): 0.000724
- ...
- With this patch I get:
- $ time git help git
- Launching default browser to display HTML ...
- real 0m8.723s
- user 0m0.000s
- sys 0m0.000s
- and without
- $ time git help git
- Launching default browser to display HTML ...
- real 1m37.734s
- user 0m0.000s
- sys 0m0.031s
- both tests with cold cache and giving the machine some time to settle
- down after restart.
- [jes: adjusted the commit message]
- Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mingw: allow hooks to be .exe files
- Executable files in Windows need to have the extension '.exe', otherwise
- they do not work. Extend the hooks to not just look at the hard coded
- names, but also at the names extended by the custom STRIP_EXTENSION,
- which is defined as '.exe' in Windows.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pack-objects: convert recursion to iteration in break_delta_chain()
- The break_delta_chain() function is recursive over the depth
- of a given delta chain, which can lead to possibly running
- out of stack space. Normally delta depth is quite small, but
- if there _is_ a pathological case, this is where we would
- find and fix it, so we should be more careful.
- We can do it without recursion at all, but there's a little
- bit of cleverness needed to do so. It's easiest to explain
- by covering the less-clever strategies first.
- The obvious thing to try is just keeping our own stack on
- the heap. Whenever we would recurse, push the new entry onto
- the stack and loop instead. But this gets tricky; when we
- see an ACTIVE entry, we need to care if we just pushed it
- (in which case it's a cycle) or if we just popped it (in
- which case we dealt with its bases, and no we need to clear
- the ACTIVE flag and compute its depth).
- You can hack around that in various ways, like keeping a
- "just pushed" flag, but the logic gets muddled. However, we
- can observe that we do all of our pushes first, and then all
- of our pops afterwards. In other words, we can do this in
- two passes. First dig down to the base, stopping when we see
- a cycle, and pushing each item onto our stack. Then pop the
- stack elements, clearing the ACTIVE flag and computing the
- depth for each.
- This works, and is reasonably elegant. However, why do we
- need the stack for the second pass? We can just walk the
- delta pointers again. There's one complication. Popping the
- stack went over our list in reverse, so we could compute the
- depth of each entry by incrementing the depth of its base,
- which we will have just computed. To go forward in the
- second pass, we have to compute the total depth on the way
- down, and then assign it as we go.
- This patch implements this final strategy, because it not
- only keeps the memory off the stack, but it eliminates it
- entirely. Credit for the cleverness in that approach goes to
- Michael Haggerty; bugs are mine.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pack-objects: enforce --depth limit in reused deltas
- Since 898b14c (pack-objects: rework check_delta_limit usage,
- 2007-04-16), we check the delta depth limit only when
- figuring out whether we should make a new delta. We don't
- consider it at all when reusing deltas, which means that
- packing once with --depth=250, and then again with
- --depth=50, the second pack may still contain chains larger
- than 50.
- This is generally considered a feature, as the results of
- earlier high-depth repacks are carried forward, used for
- serving fetches, etc. However, since we started using
- cross-pack deltas in c9af708b1 (pack-objects: use mru list
- when iterating over packs, 2016-08-11), we are no longer
- bounded by the length of an existing delta chain in a single
- pack.
- Here's one particular pathological case: a sequence of N
- packs, each with 2 objects, the base of which is stored as a
- delta in a previous pack. If we chain all the deltas
- together, we have a cycle of length N. We break the cycle,
- but the tip delta is still at depth N-1.
- This is less unlikely than it might sound. See the included
- test for a reconstruction based on real-world actions. I
- ran into such a case in the wild, where a client was rapidly
- sending packs, and we had accumulated 10,000 before doing a
- server-side repack. The pack that "git repack" tried to
- generate had a very deep chain, which caused pack-objects to
- run out of stack space in the recursive write_one().
- This patch bounds the length of delta chains in the output
- pack based on --depth, regardless of whether they are caused
- by cross-pack deltas or existed in the input packs. This
- fixes the problem, but does have two possible downsides:
- 1. High-depth aggressive repacks followed by "normal"
- repacks will throw away the high-depth chains.
- In the long run this is probably OK; investigation
- showed that high-depth repacks aren't actually
- beneficial, and we dropped the aggressive depth default
- to match the normal case in 07e7dbf0d (gc: default
- aggressive depth to 50, 2016-08-11).
- 2. If you really do want to store high-depth deltas on
- disk, they may be discarded and new delta computed when
- serving a fetch, unless you set pack.depth to match
- your high-depth size.
- The implementation uses the existing search for delta
- cycles. That lets us compute the depth of any node based on
- the depth of its base, because we know the base is DFS_DONE
- by the time we look at it (modulo any cycles in the graph,
- but we know there cannot be any because we break them as we
- see them).
- There is some subtlety worth mentioning, though. We record
- the depth of each object as we compute it. It might seem
- like we could save the per-object storage space by just
- keeping track of the depth of our traversal (i.e., have
- break_delta_chains() report how deep it went). But we may
- visit an object through multiple delta paths, and on
- subsequent paths we want to know its depth immediately,
- without having to walk back down to its final base (doing so
- would make our graph walk quadratic rather than linear).
- Likewise, one could try to record the depth not from the
- base, but from our starting point (i.e., start
- recursion_depth at 0, and pass "recursion_depth + 1" to each
- invocation of break_delta_chains()). And then when
- recursion_depth gets too big, we know that we must cut the
- delta chain. But that technique is wrong if we do not visit
- the nodes in topological order. In a chain A->B->C, it
- if we visit "C", then "B", then "A", we will never recurse
- deeper than 1 link (because we see at each node that we have
- already visited it).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: clarify distinction between sign-off and pgp-signing
- The documentation for submission discourages pgp-signing, but demands
- a proper sign-off by contributors. However, when skimming the headings,
- the wording of the section for sign-off could mistakenly be understood
- as concerning pgp-signing. Thus, new contributors could oversee the
- necessary sign-off.
- This commit improves the wording such that the section about sign-off
- cannot be misunderstood as pgp-signing. In addition, the paragraph about
- pgp-signing is changed such that it avoids the impression that
- pgp-signing could be relevant at later stages of the submission.
- Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
- Helped-by: Philip Oakley <philipoakley@iee.org>
- Helped-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- test-lib: on FreeBSD, look for unzip(1) in /usr/local/bin/
- Eric Wong reported that while FreeBSD has a /usr/bin/unzip, it uses
- different semantics from those that are needed by Git's tests: When
- passing the -a option to Info-Zip, it heeds the text attribute of the
- .zip file's central directory, while FreeBSD's unzip ignores that
- attribute.
- The common work-around is to install Info-Zip on FreeBSD, into
- /usr/local/bin/.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Tested-by: Eric Wong <e@80x24.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t/Makefile: add a rule to re-run previously-failed tests
- This patch automates the process of determining which tests failed
- previously and re-running them.
- While developing patch series, it is a good practice to run the test
- suite from time to time, just to make sure that obvious bugs are caught
- early. With complex patch series, it is common to run `make -j15 -k
- test`, i.e. run the tests in parallel and *not* stop at the first
- failing test but continue. This has the advantage of identifying
- possibly multiple problems in one big test run.
- It is particularly important to reduce the turn-around time thusly on
- Windows, where the test suite spends 45 minutes on the computer on which
- this patch was developed.
- It is the most convenient way to determine which tests failed after
- running the entire test suite, in parallel, to look for left-over "trash
- directory.t*" subdirectories in the t/ subdirectory. However, those
- directories might live outside t/ when overridden using the
- --root=<directory> option, to which the Makefile has no access. The next
- best method is to grep explicitly for failed tests in the test-results/
- directory, which the Makefile *can* access.
- Please note that the often-recommended `prove` tool requires Perl, and
- that opens a whole new can of worms on Windows. As no native Windows Perl
- comes with Subversion bindings, we have to use a Perl in Git for Windows
- that uses the POSIX emulation layer named MSYS2 (which is a portable
- version of Cygwin). When using this emulation layer under stress, e.g.
- when running massively-parallel tests, unexplicable crashes occur quite
- frequently, and instead of having a solution to the original problem, the
- developer now has an additional, quite huge problem. For that reason, this
- developer rejected `prove` as a solution and went with this patch instead.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- use absolute_pathdup()
- Apply the semantic patch for converting callers that duplicate the
- result of absolute_path() to call absolute_pathdup() instead, which
- avoids an extra string copy to a static buffer.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- abspath: add absolute_pathdup()
- Add a function that returns a buffer containing the absolute path of its
- argument and a semantic patch for its intended use. It avoids an extra
- string copy to a static buffer.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- status: be prepared for not-yet-started interactive rebase
- Some developers might want to call `git status` in a working
- directory where they just started an interactive rebase, but the
- edit script is still opened in the editor.
- Let's show a meaningful message in such cases.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- connect: rename tortoiseplink and putty variables
- One of these two may have originally been named after "what exact
- SSH implementation do we have?" so that we can tweak the command
- line options for that exact implementation. But "putty=1" no longer
- means "We are using the plink SSH implementation that comes with
- PuTTY" these days. It is set when we guess that either PuTTY plink
- or Tortoiseplink is in use.
- Rename them after what effect is desired. The current 'putty'
- option is about using "-P <port>" when OpenSSH would use "-p <port>",
- so rename it to 'port_option' whose value is either 'p' or 'P". The
- other one is about passing an extra command line option "-batch",
- so rename it to 'needs_batch'.
- [jes: wrapped overly-long line]
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule update: run custom update script for initial populating as well
- In 1b4735d9f3 (submodule: no [--merge|--rebase] when newly cloned,
- 2011-02-17), all actions were defaulted to checkout for populating
- a submodule initially, because merging or rebasing makes no sense
- in that situation.
- Other commands however do make sense, such as the custom command
- that was added later (6cb5728c43, submodule update: allow custom
- command to update submodule working tree, 2013-07-03).
- I am unsure about the "none" command, as I can see an initial
- checkout there as a useful thing. On the other hand going strictly
- by our own documentation, we should do nothing in case of "none"
- as well, because the user asked for it.
- Reported-by: Han-Wen Nienhuys <hanwen@google.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule absorbing: fix worktree/gitdir pointers recursively for non-moves
- Consider having a submodule 'sub' and a nested submodule at 'sub/nested'.
- When nested is already absorbed into sub, but sub is not absorbed into
- its superproject, then we need to fixup the gitfile and core.worktree
- setting for 'nested' when absorbing 'sub', but we do not need to move
- its git dir around.
- Previously 'nested's gitfile contained "gitdir: ../.git/modules/nested";
- it has to be corrected to "gitdir: ../../.git/modules/sub1/modules/nested".
- An alternative I considered to do this work lazily, i.e. when resolving
- "../.git/modules/nested", we would notice the ".git" being a gitfile
- linking to another path. That seemed to be robuster by design, but harder
- to get the implementation right. Maybe we have to do that anyway once we
- try to have submodules and worktrees working nicely together, but for now
- just produce 'correct' (i.e. direct) pointers.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- cache.h: expose the dying procedure for reading gitlinks
- In a later patch we want to react to only a subset of errors, defaulting
- the rest to die as usual. Separate the block that takes care of dying
- into its own function so we have easy access to it.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- setup: add gentle version of resolve_git_dir
- This follows a93bedada (setup: add gentle version of read_gitfile,
- 2015-06-09), and assumes the same reasoning. resolve_git_dir is unsuited
- for speculative calls, so we want to use the gentle version to find out
- about potential errors.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: lazily load types under --connectivity-only
- The recent fixes to "fsck --connectivity-only" load all of
- the objects with their correct types. This keeps the
- connectivity-only code path close to the regular one, but it
- also introduces some unnecessary inefficiency. While getting
- the type of an object is cheap compared to actually opening
- and parsing the object (as the non-connectivity-only case
- would do), it's still not free.
- For reachable non-blob objects, we end up having to parse
- them later anyway (to see what they point to), making our
- type lookup here redundant.
- For unreachable objects, we might never hit them at all in
- the reachability traversal, making the lookup completely
- wasted. And in some cases, we might have quite a few
- unreachable objects (e.g., when alternates are used for
- shared object storage between repositories, it's normal for
- there to be objects reachable from other repositories but
- not the one running fsck).
- The comment in mark_object_for_connectivity() claims two
- benefits to getting the type up front:
- 1. We need to know the types during fsck_walk(). (And not
- explicitly mentioned, but we also need them when
- printing the types of broken or dangling commits).
- We can address this by lazy-loading the types as
- necessary. Most objects never need this lazy-load at
- all, because they fall into one of these categories:
- a. Reachable from our tips, and are coerced into the
- correct type as we traverse (e.g., a parent link
- will call lookup_commit(), which converts OBJ_NONE
- to OBJ_COMMIT).
- b. Unreachable, but not at the tip of a chunk of
- unreachable history. We only mention the tips as
- "dangling", so an unreachable commit which links
- to hundreds of other objects needs only report the
- type of the tip commit.
- 2. It serves as a cross-check that the coercion in (1a) is
- correct (i.e., we'll complain about a parent link that
- points to a blob). But we get most of this for free
- already, because right after coercing, we'll parse any
- non-blob objects. So we'd notice then if we expected a
- commit and got a blob.
- The one exception is when we expect a blob, in which
- case we never actually read the object contents.
- So this is a slight weakening, but given that the whole
- point of --connectivity-only is to sacrifice some data
- integrity checks for speed, this seems like an
- acceptable tradeoff.
- Here are before and after timings for an extreme case with
- ~5M reachable objects and another ~12M unreachable (it's the
- torvalds/linux repository on GitHub, connected to shared
- storage for all of the other kernel forks):
- [before]
- $ time git fsck --no-dangling --connectivity-only
- real 3m4.323s
- user 1m25.121s
- sys 1m38.710s
- [after]
- $ time git fsck --no-dangling --connectivity-only
- real 0m51.497s
- user 0m49.575s
- sys 0m1.776s
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: move typename() printing to its own function
- When an object has a problem, we mention its type. But we do
- so by feeding the result of typename() directly to
- fprintf(). This is potentially dangerous because typename()
- can return NULL for some type values (like OBJ_NONE).
- It's doubtful that this can be triggered in practice with
- the current code, so this is probably not fixing a bug. But
- it future-proofs us against modifications that make things
- like OBJ_NONE more likely (and gives future patches a
- central point to handle them).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- relink: really remove the command
- The files in contrib/examples are meant to illustrate "you could
- combine plumbing commands to implement something like these"; this
- is an opposite and is an example of what not to do, e.g. accessing
- the object store directly bypassing Git.
- Remove it.
- Suggested-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- relink: retire the command
- Back in the olden days, when all objects were loose and rubber boots were
- made out of wood, it made sense to try to share (immutable) objects
- between repositories.
- Ever since the arrival of pack files, it is but an anachronism.
- Let's move the script to the contrib/examples/ directory and no longer
- offer it.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- connect: handle putty/plink also in GIT_SSH_COMMAND
- Git for Windows has special support for the popular SSH client PuTTY:
- when using PuTTY's non-interactive version ("plink.exe"), we use the -P
- option to specify the port rather than OpenSSH's -p option. TortoiseGit
- ships with its own, forked version of plink.exe, that adds support for
- the -batch option, and for good measure we special-case that, too.
- However, this special-casing of PuTTY only covers the case where the
- user overrides the SSH command via the environment variable GIT_SSH
- (which allows specifying the name of the executable), not
- GIT_SSH_COMMAND (which allows specifying a full command, including
- additional command-line options).
- When users want to pass any additional arguments to (Tortoise-)Plink,
- such as setting a private key, they are required to either use a shell
- script named plink or tortoiseplink or duplicate the logic that is
- already in Git for passing the correct style of command line arguments,
- which can be difficult, error prone and annoying to get right.
- This patch simply reuses the existing logic and expands it to cover
- GIT_SSH_COMMAND, too.
- Note: it may look a little heavy-handed to duplicate the entire
- command-line and then split it, only to extract the name of the
- executable. However, this is not a performance-critical code path, and
- the code is much more readable this way.
- Signed-off-by: Segev Finer <segev208@gmail.com>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: hack around -Wzero-length-format warning
- Building with "gcc -Wall" will complain that the format in:
- warning("")
- is empty. Which is true, but the warning is over-eager. We
- are calling the function for its side effect of printing
- "warning:", even with an empty string.
- Our DEVELOPER Makefile knob disables the warning, but not
- everybody uses it. Let's silence the warning in the code so
- that nobody reports it or tries to "fix" it.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- unpack-trees: support super-prefix option
- In the future we want to support working tree operations within submodules,
- e.g. "git checkout --recurse-submodules", which will update the submodule
- to the commit as recorded in its superproject. In the submodule the
- unpack-tree operation is carried out as usual, but the reporting to the
- user needs to prefix any path with the superproject. The mechanism for
- this is the super-prefix. (see 74866d757, git: make super-prefix option)
- Add support for the super-prefix option for commands that unpack trees
- by wrapping any path output in unpacking trees in the newly introduced
- super_prefixed function. This new function prefixes any path with the
- super-prefix if there is one. Assuming the submodule case doesn't happen
- in the majority of the cases, we'd want to have a fast behavior for no
- super prefix, i.e. no reallocation/copying, but just returning path.
- Another aspect of introducing the `super_prefixed` function is to consider
- who owns the memory and if this is the right place where the path gets
- modified. As the super prefix ought to change the output behavior only and
- not the actual unpack tree part, it is fine to be that late in the line.
- As we get passed in 'const char *path', we cannot change the path itself,
- which means in case of a super prefix we have to copy over the path.
- We need two static buffers in that function as the error messages
- contain at most two paths.
- For testing purposes enable it in read-tree, which has no output
- of paths other than an unpack-trees.c. These are all converted in
- this patch.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t1450: use "mv -f" within loose object directory
- The loose objects are created with mode 0444. That doesn't
- prevent them being overwritten by rename(), but some
- versions of "mv" will be extra careful and prompt the user,
- even without "-i".
- Reportedly macOS does this, at least in the Travis builds.
- The prompt reads from /dev/null, defaulting to "no", and the
- object isn't moved. Then to make matters even more
- interesting, it still returns "0" and the rest of the test
- proceeds, but with a broken setup.
- We can work around it by using "mv -f" to override the
- prompt. This should work as it's already used in t5504 for
- the same purpose.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'master' of https://github.com/Softcatala/git-po
- * 'master' of https://github.com/Softcatala/git-po:
- l10n: fixes to Catalan translation
- show-ref: remove a stale comment
- When cf0adba788 ("Store peeled refs in packed-refs file.",
- 2006-11-19) made the command to die with a message on error even
- when --quiet is passed, it left the comment to say it changed the
- semantics. But that kind of information belongs to the log message,
- not in-code comment. Besides, the behaviour after the change has
- been the established one for the past 10 years ;-)
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- describe: teach describe negative pattern matches
- Teach git-describe the `--exclude` option which will allow specifying
- a glob pattern of tags to ignore. This can be combined with the
- `--match` patterns to enable more flexibility in determining which tags
- to consider.
- For example, suppose you wish to find the first official release tag
- that contains a certain commit. If we assume that official release tags
- are of the form "v*" and pre-release candidates include "*rc*" in their
- name, we can now find the first release tag that introduces the commit
- abcdef:
- git describe --contains --match="v*" --exclude="*rc*" abcdef
- Add documentation, tests, and completion for this change.
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- describe: teach --match to accept multiple patterns
- Teach `--match` to be accepted multiple times, accumulating a list of
- patterns to match into a string list. Each pattern is inclusive, such
- that a tag need only match one of the provided patterns to be
- considered for matching.
- This extension is useful as it enables more flexibility in what tags
- match, and may avoid the need to run the describe command multiple
- times to get the same result.
- Add tests and update the documentation for this change.
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- name-rev: add support to exclude refs by pattern match
- Extend git-name-rev to support excluding refs which match shell patterns
- using --exclude. These patterns can be used to limit the scope of refs
- by excluding any ref that matches one of the --exclude patterns. A ref
- will only be used for naming when it matches at least one --refs pattern
- but does not match any of the --exclude patterns. Thus, --exclude
- patterns are given precedence over --refs patterns.
- For example, suppose you wish to name a series of commits based on an
- official release tag of the form "v*" but excluding any pre-release tags
- which match "*rc*". You can use the following to do so:
- git name-rev --refs="v*" --exclude="*rc*" --all
- Add tests and update Documentation for this change.
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- name-rev: extend --refs to accept multiple patterns
- Teach git name-rev to take multiple --refs stored as a string list of
- patterns. The list of patterns will be matched inclusively, and each ref
- only needs to match one pattern to be included. A ref will only be
- excluded if it does not match any of the given patterns. Additionally,
- if any of the patterns would allow abbreviation, then we will abbreviate
- the ref, even if another pattern is more strict and would not have
- allowed abbreviation on its own.
- Add tests and documentation for this change. The tests expected output
- is dynamically generated. This is in order to avoid hard-coding
- a commit object name in the test results (as the expected output is to
- simply leave the commit object unnamed).
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- log --graph: customize the graph lines with config log.graphColors
- If you have a 256 colors terminal (or one with true color support), then
- the predefined 12 colors seem limited. On the other hand, you don't want
- to draw graph lines with every single color in this mode because the two
- colors could look extremely similar. This option allows you to hand pick
- the colors you want.
- Even with standard terminal, if your background color is neither black
- or white, then the graph line may match your background and become
- hidden. You can exclude your background color (or simply the colors you
- hate) with this.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Seventh batch for 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'ws/request-pull-code-cleanup'
- Code clean-up.
- * ws/request-pull-code-cleanup:
- request-pull: drop old USAGE stuff
- Merge branch 'rh/diff-orderfile-doc'
- Documentation fix.
- * rh/diff-orderfile-doc:
- diff: document the format of the -O (diff.orderFile) file
- diff: document behavior of relative diff.orderFile
- Merge branch 'sb/cd-then-git-can-be-written-as-git-c'
- Test clean-up.
- * sb/cd-then-git-can-be-written-as-git-c:
- lib-submodule-update.sh: reduce use of subshell by using "git -C"
- Merge branch 'ad/bisect-terms'
- Documentation fix.
- * ad/bisect-terms:
- Documentation/bisect: improve on (bad|new) and (good|bad)
- Merge branch 'sg/fix-versioncmp-with-common-suffix'
- The prereleaseSuffix feature of version comparison that is used in
- "git tag -l" did not correctly when two or more prereleases for the
- same release were present (e.g. when 2.0, 2.0-beta1, and 2.0-beta2
- are there and the code needs to compare 2.0-beta1 and 2.0-beta2).
- * sg/fix-versioncmp-with-common-suffix:
- versioncmp: generalize version sort suffix reordering
- versioncmp: factor out helper for suffix matching
- versioncmp: use earliest-longest contained suffix to determine sorting order
- versioncmp: cope with common part overlapping with prerelease suffix
- versioncmp: pass full tagnames to swap_prereleases()
- t7004-tag: add version sort tests to show prerelease reordering issues
- t7004-tag: use test_config helper
- t7004-tag: delete unnecessary tags with test_when_finished
- Merge branch 'vn/diff-ihc-config'
- "git diff" learned diff.interHunkContext configuration variable
- that gives the default value for its --inter-hunk-context option.
- * vn/diff-ihc-config:
- diff: add interhunk context config option
- Merge branch 'sb/submodule-init'
- Error message fix.
- * sb/submodule-init:
- submodule update --init: display correct path from submodule
- Merge branch 'sb/submodule-embed-gitdir'
- Help-text fix.
- * sb/submodule-embed-gitdir:
- submodule absorbgitdirs: mention in docstring help
- Merge branch 'sb/submodule-config-tests'
- Test updates.
- * sb/submodule-config-tests:
- t7411: test lookup of uninitialized submodules
- t7411: quote URLs
- Merge branch 'jk/grep-e-could-be-extended-beyond-posix'
- Tighten a test to avoid mistaking an extended ERE regexp engine as
- a PRE regexp engine.
- * jk/grep-e-could-be-extended-beyond-posix:
- t7810: avoid assumption about invalid regex syntax
- Merge branch 'bw/read-blob-data-does-not-modify-index-state'
- Code clean-up.
- * bw/read-blob-data-does-not-modify-index-state:
- index: improve constness for reading blob data
- show-ref: remove dead `if (verify)' check
- As show_ref() is only ever called on the path where --verify is not
- specified, `verify' can never possibly be true here.
- Signed-off-by: Vladimir Panteleev <git@thecybershadow.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- show-ref: detect dangling refs under --verify as well
- Move detection of dangling refs into show_one(), so that they are
- detected when --verify is present as well as when it is absent.
- Signed-off-by: Vladimir Panteleev <git@thecybershadow.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- show-ref: move --quiet handling into show_one()
- Do the same with --quiet as was done with -d, to remove the need to
- perform this check at show_one()'s call site from the --verify branch.
- Signed-off-by: Vladimir Panteleev <git@thecybershadow.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- show-ref: allow -d to work with --verify
- Move handling of -d into show_one(), so that it takes effect when
- --verify is present as well as when it is absent. This is useful when
- the user wishes to avoid the costly iteration of refs.
- Signed-off-by: Vladimir Panteleev <git@thecybershadow.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- show-ref: accept HEAD with --verify
- Previously, when --verify was specified, show-ref would use a separate
- code path which did not handle HEAD and treated it as an invalid
- ref. Thus, "git show-ref --verify HEAD" (where "--verify" is used
- because the user is not interested in seeing refs/remotes/origin/HEAD)
- did not work as expected.
- Instead of insisting that the input begins with "refs/", allow "HEAD"
- as well in the codepath that handles "--verify", so that all valid
- full refnames including HEAD are passed to the same output machinery.
- Signed-off-by: Vladimir Panteleev <git@thecybershadow.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: use QSORT_S in ref_array_sort()
- Pass the array of sort keys to compare_refs() via the context parameter
- of qsort_s() instead of using a global variable; that's cleaner and
- simpler. If ref_array_sort() is to be called from multiple parallel
- threads then care still needs to be taken that the global variable
- used_atom is not modified concurrently.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- string-list: use QSORT_S in string_list_sort()
- Pass the comparison function to cmp_items() via the context parameter of
- qsort_s() instead of using a global variable. That allows calling
- string_list_sort() from multiple parallel threads.
- Our qsort_s() in compat/ is slightly slower than qsort(1) from glibc
- 2.24 for sorting lots of lines:
- Test HEAD^ HEAD
- ---------------------------------------------------------------------
- 0071.2: sort(1) 0.10(0.22+0.01) 0.09(0.21+0.00) -10.0%
- 0071.3: string_list_sort() 0.16(0.15+0.01) 0.17(0.15+0.00) +6.3%
- GNU sort(1) version 8.26 is significantly faster because it uses
- multiple parallel threads; with the unportable option --parallel=1 it
- becomes slower:
- Test HEAD^ HEAD
- --------------------------------------------------------------------
- 0071.2: sort(1) 0.21(0.18+0.01) 0.20(0.18+0.01) -4.8%
- 0071.3: string_list_sort() 0.16(0.13+0.02) 0.17(0.15+0.01) +6.3%
- There is some instability -- the numbers for the sort(1) check shouldn't
- be affected by this patch. Anyway, the performance of our qsort_s()
- implementation is apparently good enough, at least for this test.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- perf: add basic sort performance test
- Add a sort command to test-string-list that reads lines from stdin,
- stores them in a string_list and then sorts it. Use it in a simple
- perf test script to measure the performance of string_list_sort().
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- add QSORT_S
- Add the macro QSORT_S, a convenient wrapper for qsort_s() that infers
- the size of the array elements and dies on error.
- Basically all possible errors are programming mistakes (passing NULL as
- base of a non-empty array, passing NULL as comparison function,
- out-of-bounds accesses), so terminating the program should be acceptable
- for most callers.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- compat: add qsort_s()
- The function qsort_s() was introduced with C11 Annex K; it provides the
- ability to pass a context pointer to the comparison function, supports
- the convention of using a NULL pointer for an empty array and performs a
- few safety checks.
- Add an implementation based on compat/qsort.c for platforms that lack a
- native standards-compliant qsort_s() (i.e. basically everyone). It
- doesn't perform the full range of possible checks: It uses size_t
- instead of rsize_t and doesn't check nmemb and size against RSIZE_MAX
- because we probably don't have the restricted size type defined. For
- the same reason it returns int instead of errno_t.
- Signed-off-by: Rene Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Makefile: add a knob to enable the use of Asciidoctor
- While Git has traditionally built its documentation using AsciiDoc, some
- people wish to use Asciidoctor for speed or other reasons. Add a
- Makefile knob, USE_ASCIIDOCTOR, that sets various options in order to
- produce acceptable output. For HTML output, XHTML5 was chosen, since
- the AsciiDoc options also produce XHTML, albeit XHTML 1.1.
- Asciidoctor does not have built-in support for the linkgit macro, but it
- is available using the Asciidoctor Extensions Lab. Add a macro to
- enable the use of this extension if it is available. Without it, the
- linkgit macros are emitted into the output.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: move dblatex arguments into variable
- Our dblatex invocation uses several style components from the AsciiDoc
- distribution, but those components are not available when building with
- Asciidoctor. Move the command line arguments into a variable so it can
- be overridden by the user or makefile configuration options.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: add XSLT to fix DocBook for Texinfo
- There are two ways to create a section in a reference document (i.e.,
- manpage) in DocBook 4: refsection elements and refsect, refsect2, and
- refsect3 elements. Either form is acceptable as of DocBook 4.2, but
- they cannot be mixed. Prior to DocBook 4.2, only the numbered forms
- were acceptable.
- docbook2texi only accepts the numbered forms, and this has not generally
- been a problem, since AsciiDoc produces the numbered forms.
- Asciidoctor, on the other hand, uses a shared backend for DocBook 4 and
- 5, and uses the unnumbered refsection elements instead.
- If we don't convert the unnumbered form to the numbered form,
- docbook2texi omits section headings, which is undesirable. Add an XSLT
- stylesheet to transform the unnumbered forms to the numbered forms
- automatically, and preprocess the DocBook XML as part of the
- transformation to Texinfo format.
- Note that this transformation is only necessary for Texinfo, since
- docbook2texi provides its own stylesheets. The DocBook stylesheets,
- which we use for other formats, provide the full range of DocBook 4 and
- 5 compatibility, and don't have this issue.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: sort sources for gitman.texi
- Sorting the sources makes it easier to compare the output using diff.
- In addition, it aids groups creating reproducible builds, as the order
- of the files is no longer dependent on the file system or other
- irrelevant factors.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: remove unneeded argument in cat-texi.perl
- The newly-added use of the warnings pragma exposes that the $menu[0]
- argument to printf has long been silently ignored, since there is no
- format specifier for it. It doesn't appear that the argument is
- actually needed, either: there is no reason to insert the name of one
- particular documentation page anywhere in the header that's being
- generated.
- Remove the unused argument, and since the format specification
- functionality is no longer needed, convert the printf to a simple print.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: modernize cat-texi.perl
- Good style for Perl includes using the strict and warnings pragmas, and
- preferring lexical file handles over bareword file handles. Using
- lexical file handles necessitates being explicit when $_ is printed, so
- that Perl does not get confused and instead print the glob ref.
- The benefit of this modernization is that a formerly obscured bug is now
- visible, which will be fixed in a followup patch.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation: fix warning in cat-texi.perl
- Newer versions of Perl produce the warning "Unescaped left brace in
- regex is deprecated, passed through in regex" when an unescaped left
- brace occurs in a regex. Escape the brace to avoid this warning.
- Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- travis-ci: fix Perforce install on macOS
- The `perforce` and `perforce-server` package were moved from brew [1][2]
- to cask [3]. Teach TravisCI the new location.
- Perforce updates their binaries without version bumps. That made the
- brew install (legitimately!) fail due to checksum mismatches. The
- workaround is not necessary anymore as Cask [4] allows to disable the
- checksum test for individual formulas.
- [1] https://github.com/Homebrew/homebrew-binary/commit/1394e42de04d07445f82f9512627e864ff4ca4c6
- [2] https://github.com/Homebrew/homebrew-binary/commit/f8da22d6b8dbcfcfdb2dfa9ac1a5e5d8e05aac2b
- [3] https://github.com/caskroom/homebrew-cask/pull/29180
- [4] https://caskroom.github.io/
- Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- contrib: remove git-convert-objects
- git-convert-objects, originally named git-convert-cache was used in
- early 2005 to convert ancient repositories where objects are named
- after the hash of their compressed contents to the current object
- naming sheme where they are named after the hash of their pre-compression
- contents.
- By now the need for conversion of the very early repositories is
- less relevant, we no longer need to keep it in contrib; remove it.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- remote rename: more carefully determine whether a remote is configured
- One of the really nice features of the ~/.gitconfig file is that users
- can override defaults by their own preferred settings for all of their
- repositories.
- One such default that some users like to override is whether the
- "origin" remote gets auto-pruned or not. The user would simply call
- git config --global remote.origin.prune true
- and from now on all "origin" remotes would be pruned automatically when
- fetching into the local repository.
- There is just one catch: now Git thinks that the "origin" remote is
- configured, even if the repository config has no [remote "origin"]
- section at all, as it does not realize that the "prune" setting was
- configured globally and that there really is no "origin" remote
- configured in this repository.
- That is a problem e.g. when renaming a remote to a new name, when Git
- may be fooled into thinking that there is already a remote of that new
- name.
- Let's fix this by paying more attention to *where* the remote settings
- came from: if they are configured in the local repository config, we
- must not overwrite them. If they were configured elsewhere, we cannot
- overwrite them to begin with, as we only write the repository config.
- There is only one caller of remote_is_configured() (in `git fetch`) that
- may want to take remotes into account even if they were configured
- outside the repository config; all other callers essentially try to
- prevent the Git command from overwriting settings in the repository
- config.
- To accommodate that fact, the remote_is_configured() function now
- requires a parameter that states whether the caller is interested in all
- remotes, or only in those that were configured in the repository config.
- Many thanks to Jeff King whose tireless review helped with settling for
- nothing less than the current strategy.
- This fixes https://github.com/git-for-windows/git/issues/888
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- remote rename: demonstrate a bogus "remote exists" bug
- Some users like to set `remote.origin.prune = true` in their ~/.gitconfig
- so that all of their repositories use that default.
- However, our code is ill-prepared for this, mistaking that single entry to
- mean that there is already a remote of the name "origin", even if there is
- not.
- This patch adds a test case demonstrating this issue.
- Reported by Andrew Arnott.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: retire the scripted version
- It served its purpose, but now we have a builtin difftool. Time for the
- Perl script to enjoy Florida.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: implement the functionality in the builtin
- This patch gives life to the skeleton added in the previous patch.
- The motivation for converting the difftool is that Perl scripts are not at
- all native on Windows, and that `git difftool` therefore is pretty slow on
- that platform, when there is no good reason for it to be slow.
- In addition, Perl does not really have access to Git's internals. That
- means that any script will always have to jump through unnecessary
- hoops, and it will often need to perform unnecessary work (e.g. when
- reading the entire config every time `git config` is called to query a
- single config value).
- The current version of the builtin difftool does not, however, make full
- use of the internals but instead chooses to spawn a couple of Git
- processes, still, to make for an easier conversion. There remains a lot
- of room for improvement, left later.
- Note: to play it safe, the original difftool is still called unless the
- config setting difftool.useBuiltin is set to true.
- The reason: this new, experimental, builtin difftool was shipped as part
- of Git for Windows v2.11.0, to allow for easier large-scale testing, but
- of course as an opt-in feature.
- The speedup is actually more noticable on Linux than on Windows: a quick
- test shows that t7800-difftool.sh runs in (2.183s/0.052s/0.108s)
- (real/user/sys) in a Linux VM, down from (6.529s/3.112s/0.644s), while on
- Windows, it is (36.064s/2.730s/7.194s), down from (47.637s/2.407s/6.863s).
- The culprit is most likely the overhead incurred from *still* having to
- shell out to mergetool-lib.sh and difftool--helper.sh.
- Still, it is an improvement.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: add documentation for OPT_STRING_LIST
- Commit c8ba16391655 ("parse-options: add OPT_STRING_LIST helper",
- 2011-06-09) added the OPT_STRING_LIST as a way to accumulate a repeated
- list of strings. However, this was not documented in the
- api-parse-options documentation. Add documentation now so that future
- developers may learn of its existence.
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- documentation: retire unfinished documentation
- When looking for documentation for a specific function, you may be tempted
- to run
- git -C Documentation grep index_name_pos
- only to find the file technical/api-in-core-index.txt, which doesn't
- help for understanding the given function. It would be better to not find
- these functions in the documentation, such that people directly dive into
- the code instead.
- In the previous patches we have documented
- * index_name_pos()
- * remove_index_entry_at()
- * add_[file_]to_index()
- in cache.h
- We already have documentation for:
- * add_index_entry()
- * read_index()
- Which leaves us with a TODO for:
- * cache -> the_index macros
- * refresh_index()
- * discard_index()
- * ie_match_stat() and ie_modified(); how they are different and when to
- use which.
- * write_index() that was renamed to write_locked_index
- * cache_tree_invalidate_path()
- * cache_tree_update()
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- cache.h: document add_[file_]to_index
- Helped-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- cache.h: document remove_index_entry_at
- Do this by moving the existing documentation from
- read-cache.c to cache.h.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- cache.h: document index_name_pos
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- color.c: trim leading spaces in color_parse_mem()
- Normally color_parse_mem() is called from config parser which trims the
- leading spaces already. The new caller in the next patch won't. Let's be
- tidy and trim leading spaces too (we already trim trailing spaces
- after a word).
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- color.c: fix color_parse_mem() with value_len == 0
- In this code we want to match the word "reset". If len is zero,
- strncasecmp() will return zero and we incorrectly assume it's "reset" as
- a result.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- clear_delta_base_cache(): don't modify hashmap while iterating
- On Thu, Jan 19, 2017 at 03:03:46PM +0100, Ulrich Spörlein wrote:
- > > I suspect the patch below may fix things for you. It works around it by
- > > walking over the lru list (either is fine, as they both contain all
- > > entries, and since we're clearing everything, we don't care about the
- > > order).
- >
- > Confirmed. With the patch applied, I can import the whole 55G in one go
- > without any crashes or aborts. Thanks much!
- Thanks. Here it is rolled up with a commit message.
- -- >8 --
- Subject: clear_delta_base_cache(): don't modify hashmap while iterating
- Removing entries while iterating causes fast-import to
- access an already-freed `struct packed_git`, leading to
- various confusing errors.
- What happens is that clear_delta_base_cache() drops the
- whole contents of the cache by iterating over the hashmap,
- calling release_delta_base_cache() on each entry. That
- function removes the item from the hashmap. The hashmap code
- may then shrink the table, but the hashmap_iter struct
- retains an offset from the old table.
- As a result, the next call to hashmap_iter_next() may claim
- that the iteration is done, even though some items haven't
- been visited.
- The only caller of clear_delta_base_cache() is fast-import,
- which wants to clear the cache because it is discarding the
- packed_git struct for its temporary pack. So by failing to
- remove all of the entries, we still have references to the
- freed packed_git.
- To make things even more confusing, this doesn't seem to
- trigger with the test suite, because it depends on
- complexities like the size of the hash table, which entries
- got cleared, whether we try to access them before they're
- evicted from the cache, etc.
- So I've been able to identify the problem with large
- imports like freebsd's svn import, or a fast-export of
- linux.git. But nothing that would be reasonable to run as
- part of the normal test suite.
- We can fix this easily by iterating over the lru linked list
- instead of the hashmap. They both contain the same entries,
- and we can use the "safe" variant of the list iterator,
- which exists for exactly this case.
- Let's also add a warning to the hashmap API documentation to
- reduce the chances of getting bit by this again.
- Reported-by: Ulrich Spörlein <uqs@freebsd.org>
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Sixth batch for 2.12
- Merge branch 'sb/remove-gitview'
- Retire long unused/unmaintained gitview from the contrib/ area.
- * sb/remove-gitview:
- doc: git-gui browser does not default to HEAD
- doc: gitk: add the upstream repo location
- doc: gitk: remove gitview reference
- contrib: remove gitview
- Merge branch 'js/asciidoctor-tweaks'
- Adjust documentation to help AsciiDoctor render better while not
- breaking the rendering done by AsciiDoc.
- * js/asciidoctor-tweaks:
- asciidoctor: fix user-manual to be built by `asciidoctor`
- giteveryday: unbreak rendering with AsciiDoctor
- Merge branch 'sb/unpack-trees-cleanup'
- Code cleanup.
- * sb/unpack-trees-cleanup:
- unpack-trees: factor progress setup out of check_updates
- unpack-trees: remove unneeded continue
- unpack-trees: move checkout state into check_updates
- Merge branch 'rh/mergetool-regression-fix'
- "git mergetool" without any pathspec on the command line that is
- run from a subdirectory became no-op in Git v2.11 by mistake, which
- has been fixed.
- * rh/mergetool-regression-fix:
- mergetool: fix running in subdir when rerere enabled
- mergetool: take the "-O" out of $orderfile
- t7610: add test case for rerere+mergetool+subdir bug
- t7610: spell 'git reset --hard' consistently
- t7610: don't assume the checked-out commit
- t7610: always work on a test-specific branch
- t7610: delete some now-unnecessary 'git reset --hard' lines
- t7610: run 'git reset --hard' after each test to clean up
- t7610: don't rely on state from previous test
- t7610: use test_when_finished for cleanup tasks
- t7610: move setup code to the 'setup' test case
- t7610: update branch names to match test number
- rev-parse doc: pass "--" to rev-parse in the --prefix example
- .mailmap: record canonical email for Richard Hansen
- Merge branch 'bw/realpath-wo-chdir'
- The implementation of "real_path()" was to go there with chdir(2)
- and call getcwd(3), but this obviously wouldn't be usable in a
- threaded environment. Rewrite it to manually resolve relative
- paths including symbolic links in path components.
- * bw/realpath-wo-chdir:
- real_path: set errno when max number of symlinks is exceeded
- real_path: prevent redefinition of MAXSYMLINKS
- Merge branch 'jk/execv-dashed-external'
- Typing ^C to pager, which usually does not kill it, killed Git and
- took the pager down as a collateral damage in certain process-tree
- structure. This has been fixed.
- * jk/execv-dashed-external:
- execv_dashed_external: wait for child on signal death
- execv_dashed_external: stop exiting with negative code
- execv_dashed_external: use child_process struct
- Merge branch 'sp/cygwin-build-fixes'
- Build updates for Cygwin.
- * sp/cygwin-build-fixes:
- Makefile: put LIBS after LDFLAGS for imap-send
- Makefile: POSIX windres
- Merge branch 'sb/pathspec-errors'
- Running "git add a/b" when "a" is a submodule correctly errored
- out, but without a meaningful error message.
- * sb/pathspec-errors:
- pathspec: give better message for submodule related pathspec error
- Merge branch 'pb/test-must-fail-is-for-git'
- Test cleanup.
- * pb/test-must-fail-is-for-git:
- t9813: avoid using pipes
- don't use test_must_fail with grep
- Merge branch 'bw/pathspec-cleanup'
- Code clean-up in the pathspec API.
- * bw/pathspec-cleanup:
- pathspec: rename prefix_pathspec to init_pathspec_item
- pathspec: small readability changes
- pathspec: create strip submodule slash helpers
- pathspec: create parse_element_magic helper
- pathspec: create parse_long_magic function
- pathspec: create parse_short_magic function
- pathspec: factor global magic into its own function
- pathspec: simpler logic to prefix original pathspec elements
- pathspec: always show mnemonic and name in unsupported_magic
- pathspec: remove unused variable from unsupported_magic
- pathspec: copy and free owned memory
- pathspec: remove the deprecated get_pathspec function
- ls-tree: convert show_recursive to use the pathspec struct interface
- dir: convert fill_directory to use the pathspec struct interface
- dir: remove struct path_simplify
- mv: remove use of deprecated 'get_pathspec()'
- Merge branch 'js/mingw-test-push-unc-path'
- "git push \\server\share\dir" has recently regressed and then
- fixed. A test has retroactively been added for this breakage.
- * js/mingw-test-push-unc-path:
- mingw: add a regression test for pushing to UNC paths
- Merge branch 'sb/submodule-cleanup-export-git-dir-env'
- Code cleanup.
- * sb/submodule-cleanup-export-git-dir-env:
- submodule.c: use GIT_DIR_ENVIRONMENT consistently
- Merge branch 'km/branch-get-push-while-detached'
- "git <cmd> @{push}" on a detached HEAD used to segfault; it has
- been corrected to error out with a message.
- * km/branch-get-push-while-detached:
- branch_get_push: do not segfault when HEAD is detached
- Merge branch 'jk/rebase-i-squash-count-fix'
- "git rebase -i" with a recent update started showing an incorrect
- count when squashing more than 10 commits.
- * jk/rebase-i-squash-count-fix:
- rebase--interactive: count squash commits above 10 correctly
- Merge branch 'jk/blame-fixes'
- "git blame --porcelain" misidentified the "previous" <commit, path>
- pair (aka "source") when contents came from two or more files.
- * jk/blame-fixes:
- blame: output porcelain "previous" header for each file
- blame: handle --no-abbrev
- blame: fix alignment with --abbrev=40
- Merge branch 'jk/archive-zip-userdiff-config'
- "git archive" did not read the standard configuration files, and
- failed to notice a file that is marked as binary via the userdiff
- driver configuration.
- * jk/archive-zip-userdiff-config:
- archive-zip: load userdiff config
- Merge branch 'dt/disable-bitmap-in-auto-gc'
- It is natural that "git gc --auto" may not attempt to pack
- everything into a single pack, and there is no point in warning
- when the user has configured the system to use the pack bitmap,
- leading to disabling further "gc".
- * dt/disable-bitmap-in-auto-gc:
- repack: die on incremental + write-bitmap-index
- auto gc: don't write bitmaps for incremental repacks
- Merge branch 'ls/p4-retry-thrice'
- A recent updates to "git p4" was not usable for older p4 but it
- could be made to work with minimum changes. Do so.
- * ls/p4-retry-thrice:
- git-p4: do not pass '-r 0' to p4 commands
- Merge branch 'sb/submodule-rm-absorb'
- "git rm" used to refuse to remove a submodule when it has its own
- git repository embedded in its working tree. It learned to move
- the repository away to $GIT_DIR/modules/ of the superproject
- instead, and allow the submodule to be deleted (as long as there
- will be no loss of local modifications, that is).
- * sb/submodule-rm-absorb:
- rm: absorb a submodules git dir before deletion
- submodule: rename and add flags to ok_to_remove_submodule
- submodule: modernize ok_to_remove_submodule to use argv_array
- submodule.h: add extern keyword to functions
- Merge branch 'bw/grep-recurse-submodules'
- "git grep" has been taught to optionally recurse into submodules.
- * bw/grep-recurse-submodules:
- grep: search history of moved submodules
- grep: enable recurse-submodules to work on <tree> objects
- grep: optionally recurse into submodules
- grep: add submodules as a grep source type
- submodules: load gitmodules file from commit sha1
- submodules: add helper to determine if a submodule is initialized
- submodules: add helper to determine if a submodule is populated
- real_path: canonicalize directory separators in root parts
- real_path: have callers use real_pathdup and strbuf_realpath
- real_path: create real_pathdup
- real_path: convert real_path_internal to strbuf_realpath
- real_path: resolve symlinks by hand
- mingw: follow-up to "replace isatty() hack"
- The version of the "replace isatty() hack" that got merged a few
- weeks ago did not actually reflect the latest iteration of the patch
- series: v3 was sent out with these changes, as requested by the
- reviewer Johannes Sixt:
- - reworded the comment about "recycling handles"
- - moved the reassignment of the `console` variable before the dup2()
- call so that it is valid at all times
- - removed the "handle = INVALID_HANDLE_VALUE" assignment, as the local
- variable `handle` is not used afterwards anyway
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Reviewed-by: Johannes Sixt <j6t@kdbg.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t/t7004-tag: Add --format specifier tests
- tag -v now supports --format specifiers to inspect the contents of a tag
- upon verification. Add two tests to ensure this behavior is respected in
- future changes.
- Signed-off-by: Santiago Torres <santiago@nyu.edu>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t/t7030-verify-tag: Add --format specifier tests
- Verify-tag now provides --format specifiers to inspect and ensure the
- contents of the tag are proper. We add two tests to ensure this
- functionality works as expected: the return value should indicate if
- verification passed, and the format specifiers must be respected.
- Signed-off-by: Santiago Torres <santiago@nyu.edu>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- builtin/tag: add --format argument for tag -v
- Adding --format to git tag -v mutes the default output of the GPG
- verification and instead prints the formatted tag object.
- This allows callers to cross-check the tagname from refs/tags with
- the tagname from the tag object header upon GPG verification.
- The callback function for for_each_tag_name() didn't allow callers to
- pass custom data to their callback functions. Add a new opaque pointer
- to each_tag_name_fn's parameter to allow this.
- Signed-off-by: Lukas Puehringer <luk.puehringer@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge git://ozlabs.org/~paulus/gitk
- * 'master' of git://ozlabs.org/~paulus/gitk:
- gitk: Remove translated message from comments
- gitk: ru.po: Update Russian translation
- gitk: Update copyright notice to 2016
- gitk: Clear array 'commitinfo' on reload
- gitk: Remove closed file descriptors from $blobdifffd
- gitk: Turn off undo manager in the text widget
- gitk: Fix Japanese translation for "marked commit"
- gitk: Fix missing commits when using -S or -G
- gitk: Use explicit RGB green instead of "lime"
- gitk: Add Portuguese translation
- gitk: Makefile: create install bin directory
- gitk: Include commit title in branch dialog
- gitk: Allow checking out a remote branch
- gitk: Add a 'rename' option to the branch context menu
- gitk: Remove translated message from comments
- "make update-po" fails because a previously untranslated string
- has now been translated:
- Updating po/sv.po
- po/sv.po:1388: duplicate message definition...
- po/sv.po:380: ...this is the location of the first definition
- Remove the duplicate message definition.
- Reported-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- builtin/verify-tag: add --format to verify-tag
- Callers of verify-tag may want to cross-check the tagname from refs/tags
- with the tagname from the tag object header upon GPG verification. This
- is to avoid tag refs that point to an incorrect object.
- Add a --format parameter to git verify-tag to print the formatted tag
- object header in addition to or instead of the --verbose or --raw GPG
- verification output.
- Signed-off-by: Santiago Torres <santiago@nyu.edu>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: add function to print single ref_array_item
- ref-filter functions are useful for printing git object information
- using a format specifier. However, some other modules may not want to use
- this functionality on a ref-array but only print a single item.
- Expose a pretty_print_ref function to create, pretty print and free
- individual ref-items.
- Signed-off-by: Lukas Puehringer <luk.puehringer@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- gpg-interface, tag: add GPG_VERIFY_OMIT_STATUS flag
- Functions that print git object information may require that the
- gpg-interface functions be silent. Add GPG_VERIFY_OMIT_STATUS flag and
- prevent print_signature_buffer from being called if flag is set.
- Signed-off-by: Lukas Puehringer <luk.puehringer@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- RelNotes: drop merge-later comments for maint
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'maint'
- Almost ready for 2.11.1
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'mm/gc-safety-doc' into maint
- Doc update.
- * mm/gc-safety-doc:
- git-gc.txt: expand discussion of races with other processes
- Merge branch 'mm/push-social-engineering-attack-doc' into maint
- Doc update on fetching and pushing.
- * mm/push-social-engineering-attack-doc:
- doc: mention transfer data leaks in more places
- Merge branch 'jt/fetch-no-redundant-tag-fetch-map' into maint
- Code cleanup to avoid using redundant refspecs while fetching with
- the --tags option.
- * jt/fetch-no-redundant-tag-fetch-map:
- fetch: do not redundantly calculate tag refmap
- Merge branch 'ls/filter-process' into maint
- Doc update.
- * ls/filter-process:
- t0021: fix flaky test
- docs: warn about possible '=' in clean/smudge filter process values
- Merge branch 'kh/tutorial-grammofix' into maint
- * kh/tutorial-grammofix:
- doc: omit needless "for"
- doc: make the intent of sentence clearer
- doc: add verb in front of command to run
- doc: add articles (grammar)
- Merge branch 'lr/doc-fix-cet' into maint
- * lr/doc-fix-cet:
- date-formats.txt: Typo fix
- Merge branch 'sb/t3600-cleanup' into maint
- Code cleanup.
- * sb/t3600-cleanup:
- t3600: slightly modernize style
- t3600: remove useless redirect
- Merge branch 'jk/readme-gmane-is-no-more' into maint
- * jk/readme-gmane-is-no-more:
- README: replace gmane link with public-inbox
- Merge branch 'sb/unpack-trees-grammofix' into maint
- * sb/unpack-trees-grammofix:
- unpack-trees: fix grammar for untracked files in directories
- Merge branch 'ls/t0021-fixup' into maint
- * ls/t0021-fixup:
- t0021: minor filter process test cleanup
- Merge branch 'ak/lazy-prereq-mktemp' into maint
- Test code clean-up.
- * ak/lazy-prereq-mktemp:
- t7610: clean up foo.XXXXXX tmpdir
- Merge branch 'nd/qsort-in-merge-recursive' into maint
- Code simplification.
- * nd/qsort-in-merge-recursive:
- merge-recursive.c: use string_list_sort instead of qsort
- Merge branch 'dt/smart-http-detect-server-going-away' into maint
- When the http server gives an incomplete response to a smart-http
- rpc call, it could lead to client waiting for a full response that
- will never come. Teach the client side to notice this condition
- and abort the transfer.
- An improvement counterproposal has failed.
- cf. <20161114194049.mktpsvgdhex2f4zv@sigill.intra.peff.net>
- * dt/smart-http-detect-server-going-away:
- upload-pack: optionally allow fetching any sha1
- remote-curl: don't hang when a server dies before any output
- Merge branch 'mk/mingw-winansi-ttyname-termination-fix' into maint
- A potential but unlikely buffer overflow in Windows port has been
- fixed.
- * mk/mingw-winansi-ttyname-termination-fix:
- mingw: consider that UNICODE_STRING::Length counts bytes
- Merge branch 'gv/p4-multi-path-commit-fix' into maint
- "git p4" that tracks multile p4 paths imported a single changelist
- that touches files in these multiple paths as one commit, followed
- by many empty commits. This has been fixed.
- * gv/p4-multi-path-commit-fix:
- git-p4: fix multi-path changelist empty commits
- Merge branch 'jk/difftool-in-subdir' into maint
- Even though an fix was attempted in Git 2.9.3 days, but running
- "git difftool --dir-diff" from a subdirectory never worked. This
- has been fixed.
- * jk/difftool-in-subdir:
- difftool: rename variables for consistency
- difftool: chdir as early as possible
- difftool: sanitize $workdir as early as possible
- difftool: fix dir-diff index creation when in a subdirectory
- Merge branch 'ld/p4-compare-dir-vs-symlink' into maint
- "git p4" misbehaved when swapping a directory and a symbolic link.
- * ld/p4-compare-dir-vs-symlink:
- git-p4: avoid crash adding symlinked directory
- Merge branch 'jc/push-default-explicit' into maint
- A lazy "git push" without refspec did not internally use a fully
- specified refspec to perform 'current', 'simple', or 'upstream'
- push, causing unnecessary "ambiguous ref" errors.
- * jc/push-default-explicit:
- push: test pushing ambiguously named branches
- push: do not use potentially ambiguous default refspec
- Merge branch 'jt/mailinfo-fold-in-body-headers' into maint
- Fix for NDEBUG builds.
- * jt/mailinfo-fold-in-body-headers:
- mailinfo.c: move side-effects outside of assert
- Merge branch 'jk/index-pack-wo-repo-from-stdin' into maint
- "git index-pack --stdin" needs an access to an existing repository,
- but "git index-pack file.pack" to generate an .idx file that
- corresponds to a packfile does not.
- * jk/index-pack-wo-repo-from-stdin:
- index-pack: skip collision check when not in repository
- t: use nongit() function where applicable
- index-pack: complain when --stdin is used outside of a repo
- t5000: extract nongit function to test-lib-functions.sh
- Merge branch 'jk/parseopt-usage-msg-opt' into maint
- The function usage_msg_opt() has been updated to say "fatal:"
- before the custom message programs give, when they want to die
- with a message about wrong command line options followed by the
- standard usage string.
- * jk/parseopt-usage-msg-opt:
- parse-options: print "fatal:" before usage_msg_opt()
- Merge branch 'jk/quote-env-path-list-component' into maint
- A recent update to receive-pack to make it easier to drop garbage
- objects made it clear that GIT_ALTERNATE_OBJECT_DIRECTORIES cannot
- have a pathname with a colon in it (no surprise!), and this in turn
- made it impossible to push into a repository at such a path. This
- has been fixed by introducing a quoting mechanism used when
- appending such a path to the colon-separated list.
- * jk/quote-env-path-list-component:
- t5615-alternate-env: double-quotes in file names do not work on Windows
- t5547-push-quarantine: run the path separator test on Windows, too
- tmp-objdir: quote paths we add to alternates
- alternates: accept double-quoted paths
- Merge branch 'nd/shallow-fixup' into maint
- Code cleanup in shallow boundary computation.
- * nd/shallow-fixup:
- shallow.c: remove useless code
- shallow.c: bit manipulation tweaks
- shallow.c: avoid theoretical pointer wrap-around
- shallow.c: make paint_alloc slightly more robust
- shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools
- shallow.c: rename fields in paint_info to better express their purposes
- Merge branch 'sb/sequencer-abort-safety' into maint
- Unlike "git am --abort", "git cherry-pick --abort" moved HEAD back
- to where cherry-pick started while picking multiple changes, when
- the cherry-pick stopped to ask for help from the user, and the user
- did "git reset --hard" to a different commit in order to re-attempt
- the operation.
- * sb/sequencer-abort-safety:
- Revert "sequencer: remove useless get_dir() function"
- sequencer: remove useless get_dir() function
- sequencer: make sequencer abort safer
- t3510: test that cherry-pick --abort does not unsafely change HEAD
- am: change safe_to_abort()'s not rewinding error into a warning
- am: fix filename in safe_to_abort() error message
- Merge branch 'da/mergetool-xxdiff-hotkey' into maint
- The way to specify hotkeys to "xxdiff" that is used by "git
- mergetool" has been modernized to match recent versions of xxdiff.
- * da/mergetool-xxdiff-hotkey:
- mergetools: fix xxdiff hotkeys
- Merge branch 'jc/pull-rebase-ff' into maint
- "git pull --rebase", when there is no new commits on our side since
- we forked from the upstream, should be able to fast-forward without
- invoking "git rebase", but it didn't.
- * jc/pull-rebase-ff:
- pull: fast-forward "pull --rebase=true"
- Merge branch 'js/normalize-path-copy-ceil' into maint
- A pathname that begins with "//" or "\\" on Windows is special but
- path normalization logic was unaware of it.
- * js/normalize-path-copy-ceil:
- normalize_path_copy(): fix pushing to //server/share/dir on Windows
- Merge branch 'ak/commit-only-allow-empty' into maint
- "git commit --allow-empty --only" (no pathspec) with dirty index
- ought to be an acceptable way to create a new commit that does not
- change any paths, but it was forbidden, perhaps because nobody
- needed it so far.
- * ak/commit-only-allow-empty:
- commit: remove 'Clever' message for --only --amend
- commit: make --only --allow-empty work without paths
- Merge branch 'da/difftool-dir-diff-fix' into maint
- "git difftool --dir-diff" had a minor regression when started from
- a subdirectory, which has been fixed.
- * da/difftool-dir-diff-fix:
- difftool: fix dir-diff index creation when in a subdirectory
- Merge branch 'jb/diff-no-index-no-abbrev' into maint
- "git diff --no-index" did not take "--no-abbrev" option.
- * jb/diff-no-index-no-abbrev:
- diff: handle --no-abbrev in no-index case
- Merge branch 'jk/stash-disable-renames-internally' into maint
- When diff.renames configuration is on (and with Git 2.9 and later,
- it is enabled by default, which made it worse), "git stash"
- misbehaved if a file is removed and another file with a very
- similar content is added.
- * jk/stash-disable-renames-internally:
- stash: prefer plumbing over git-diff
- Merge branch 'jk/http-walker-limit-redirect' into maint
- Update the error messages from the dumb-http client when it fails
- to obtain loose objects; we used to give sensible error message
- only upon 404 but we now forbid unexpected redirects that needs to
- be reported with something sensible.
- * jk/http-walker-limit-redirect:
- http-walker: complain about non-404 loose object errors
- http: treat http-alternates like redirects
- http: make redirects more obvious
- remote-curl: rename shadowed options variable
- http: always update the base URL for redirects
- http: simplify update_url_from_redirect
- Merge branch 'jc/renormalize-merge-kill-safer-crlf' into maint
- Fix a corner case in merge-recursive regression that crept in
- during 2.10 development cycle.
- * jc/renormalize-merge-kill-safer-crlf:
- convert: git cherry-pick -Xrenormalize did not work
- merge-recursive: handle NULL in add_cacheinfo() correctly
- cherry-pick: demonstrate a segmentation fault
- Merge branch 'ls/p4-empty-file-on-lfs' into maint
- "git p4" LFS support was broken when LFS stores an empty blob.
- * ls/p4-empty-file-on-lfs:
- git-p4: fix empty file processing for large file system backend GitLFS
- Merge branch 'da/mergetool-trust-exit-code' into maint
- mergetool.<tool>.trustExitCode configuration variable did not apply
- to built-in tools, but now it does.
- * da/mergetool-trust-exit-code:
- mergetools/vimdiff: trust Vim's exit code
- mergetool: honor mergetool.$tool.trustExitCode for built-in tools
- Merge branch 'nd/worktree-list-fixup' into maint
- The output from "git worktree list" was made in readdir() order,
- and was unstable.
- * nd/worktree-list-fixup:
- worktree list: keep the list sorted
- worktree.c: get_worktrees() takes a new flag argument
- get_worktrees() must return main worktree as first item even on error
- worktree: reorder an if statement
- worktree.c: zero new 'struct worktree' on allocation
- Merge branch 'bw/push-dry-run' into maint
- "git push --dry-run --recurse-submodule=on-demand" wasn't
- "--dry-run" in the submodules.
- * bw/push-dry-run:
- push: fix --dry-run to not push submodules
- push: --dry-run updates submodules when --recurse-submodules=on-demand
- Merge branch 'hv/submodule-not-yet-pushed-fix' into maint
- The code in "git push" to compute if any commit being pushed in the
- superproject binds a commit in a submodule that hasn't been pushed
- out was overly inefficient, making it unusable even for a small
- project that does not have any submodule but have a reasonable
- number of refs.
- * hv/submodule-not-yet-pushed-fix:
- submodule_needs_pushing(): explain the behaviour when we cannot answer
- batch check whether submodule needs pushing into one call
- serialize collection of refs that contain submodule changes
- serialize collection of changed submodules
- Merge branch 'dt/empty-submodule-in-merge' into maint
- An empty directory in a working tree that can simply be nuked used
- to interfere while merging or cherry-picking a change to create a
- submodule directory there, which has been fixed..
- * dt/empty-submodule-in-merge:
- submodules: allow empty working-tree dirs in merge/cherry-pick
- Merge branch 'jk/rev-parse-symbolic-parents-fix' into maint
- "git rev-parse --symbolic" failed with a more recent notation like
- "HEAD^-1" and "HEAD^!".
- * jk/rev-parse-symbolic-parents-fix:
- rev-parse: fix parent shorthands with --symbolic
- Merge branch 'js/mingw-isatty' into maint
- Update the isatty() emulation for Windows by updating the previous
- hack that depended on internals of (older) MSVC runtime.
- * js/mingw-isatty:
- mingw: replace isatty() hack
- mingw: fix colourization on Cygwin pseudo terminals
- mingw: adjust is_console() to work with stdin
- mingw: intercept isatty() to handle /dev/null as Git expects it
- Merge branch 'bb/unicode-9.0' into maint
- The character width table has been updated to match Unicode 9.0
- * bb/unicode-9.0:
- unicode_width.h: update the width tables to Unicode 9.0
- update_unicode.sh: remove the plane filter
- update_unicode.sh: automatically download newer definition files
- update_unicode.sh: pin the uniset repo to a known good commit
- update_unicode.sh: remove an unnecessary subshell level
- update_unicode.sh: move it into contrib/update-unicode
- Merge branch 'ls/travis-update-p4-and-lfs' into maint
- The default Travis-CI configuration specifies newer P4 and GitLFS.
- * ls/travis-update-p4-and-lfs:
- travis-ci: update P4 to 16.2 and GitLFS to 1.5.2 in Linux build
- CodingGuidelines: clarify multi-line brace style
- There are some "gray areas" around when to omit braces from
- a conditional or loop body. Since that seems to have
- resulted in some arguments, let's be a little more clear
- about our preferred style.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: check HAS_OBJ more consistently
- There are two spots that call lookup_object() and assume
- that a non-NULL result means we have the object:
- 1. When we're checking the objects given to us by the user
- on the command line.
- 2. When we're checking if a reflog entry is valid.
- This generally follows fsck's mental model that we will have
- looked at and loaded a "struct object" for each object in
- the repository. But it misses one case: if another object
- _mentioned_ an object, but we didn't actually parse it or
- verify that it exists, it will still have a struct.
- It's not clear if this is a triggerable bug or not.
- Certainly the later parts of the reachability check need to
- be careful of this, and do so by checking the HAS_OBJ flag.
- But both of these steps happen before we start traversing,
- so probably we won't have followed any links yet. Still,
- it's easy enough to be defensive here.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: do not fallback "git fsck <bogus>" to "git fsck"
- Since fsck tries to continue as much as it can after seeing
- an error, we still do the reachability check even if some
- heads we were given on the command-line are bogus. But if
- _none_ of the heads is is valid, we fallback to checking all
- refs and the index, which is not what the user asked for at
- all.
- Instead of checking "heads", the number of successful heads
- we got, check "argc" (which we know only has non-options in
- it, because parse_options removed the others).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: tighten error-checks of "git fsck <head>"
- Instead of checking reachability from the refs, you can ask
- fsck to check from a particular set of heads. However, the
- error checking here is quite lax. In particular:
- 1. It claims lookup_object() will report an error, which
- is not true. It only does a hash lookup, and the user
- has no clue that their argument was skipped.
- 2. When either the name or sha1 cannot be resolved, we
- continue to exit with a successful error code, even
- though we didn't check what the user asked us to.
- This patch fixes both of these cases.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: prepare dummy objects for --connectivity-check
- Normally fsck makes a pass over all objects to check their
- integrity, and then follows up with a reachability check to
- make sure we have all of the referenced objects (and to know
- which ones are dangling). The latter checks for the HAS_OBJ
- flag in obj->flags to see if we found the object in the
- first pass.
- Commit 02976bf85 (fsck: introduce `git fsck --connectivity-only`,
- 2015-06-22) taught fsck to skip the initial pass, and to
- fallback to has_sha1_file() instead of the HAS_OBJ check.
- However, it converted only one HAS_OBJ check to use
- has_sha1_file(). But there are many other places in
- builtin/fsck.c that assume that the flag is set (or that
- lookup_object() will return an object at all). This leads to
- several bugs with --connectivity-only:
- 1. mark_object() will not queue objects for examination,
- so recursively following links from commits to trees,
- etc, did nothing. I.e., we were checking the
- reachability of hardly anything at all.
- 2. When a set of heads is given on the command-line, we
- use lookup_object() to see if they exist. But without
- the initial pass, we assume nothing exists.
- 3. When loading reflog entries, we do a similar
- lookup_object() check, and complain that the reflog is
- broken if the object doesn't exist in our hash.
- So in short, --connectivity-only is broken pretty badly, and
- will claim that your repository is fine when it's not.
- Presumably nobody noticed for a few reasons.
- One is that the embedded test does not actually test the
- recursive nature of the reachability check. All of the
- missing objects are still in the index, and we directly
- check items from the index. This patch modifies the test to
- delete the index, which shows off breakage (1).
- Another is that --connectivity-only just skips the initial
- pass for loose objects. So on a real repository, the packed
- objects were still checked correctly. But on the flipside,
- it means that "git fsck --connectivity-only" still checks
- the sha1 of all of the packed objects, nullifying its
- original purpose of being a faster git-fsck.
- And of course the final problem is that the bug only shows
- up when there _is_ corruption, which is rare. So anybody
- running "git fsck --connectivity-only" proactively would
- assume it was being thorough, when it was not.
- One possibility for fixing this is to find all of the spots
- that rely on HAS_OBJ and tweak them for the connectivity-only
- case. But besides the risk that we might miss a spot (and I
- found three already, corresponding to the three bugs above),
- there are other parts of fsck that _can't_ work without a
- full list of objects. E.g., the list of dangling objects.
- Instead, let's make the connectivity-only case look more
- like the normal case. Rather than skip the initial pass
- completely, we'll do an abbreviated one that sets up the
- HAS_OBJ flag for each object, without actually loading the
- object data.
- That's simple and fast, and we don't have to care about the
- connectivity_only flag in the rest of the code at all.
- While we're at it, let's make sure we treat loose and packed
- objects the same (i.e., setting up dummy objects for both
- and skipping the actual sha1 check). That makes the
- connectivity-only check actually fast on a real repo (40
- seconds versus 180 seconds on my copy of linux.git).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): write out the final message
- The shell script version of the interactive rebase has a very specific
- final message. Teach the sequencer to print the same.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): write the progress into files
- For the benefit of e.g. the shell prompt, the interactive rebase not
- only displays the progress for the user to see, but also writes it into
- the msgnum/end files in the state directory.
- Teach the sequencer this new trick.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): show the progress
- The interactive rebase keeps the user informed about its progress.
- If the sequencer wants to do the grunt work of the interactive
- rebase, it also needs to show that progress.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): suggest --edit-todo upon unknown command
- This is the same behavior as known from `git rebase -i`.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): show only failed cherry-picks' output
- This is the behavior of the shell script version of the interactive
- rebase, by using the `output` function defined in `git-rebase.sh`.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): show only failed `git commit`'s output
- This is the behavior of the shell script version of the interactive
- rebase, by using the `output` function defined in `git-rebase.sh`.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer: use run_command() directly
- Instead of using the convenience function run_command_v_opt_cd_env(), we
- now use the run_command() function. The former function is simply a
- wrapper of the latter, trying to make it more convenient to use.
- However, we already have to construct the argv and the env parameters,
- and we will need even finer control e.g. over the output of the command,
- so let's just stop using the convenience function.
- Based on patches and suggestions by Johannes Sixt and Jeff King.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer: update reading author-script
- Rather than abusing a strbuf to come up with an environment block,
- let's just use the argv_array structure which serves the same
- purpose much better.
- While at it, rename the function to reflect the fact that it does
- not really care exactly what environment variables are defined in
- said file.
- Suggested-by: Jeff King <peff@peff.net>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: add a skeleton for the upcoming builtin
- This adds a builtin difftool that still falls back to the legacy Perl
- version, which has been renamed to `legacy-difftool`.
- The idea is that the new, experimental, builtin difftool immediately hands
- off to the legacy difftool for now, unless the config variable
- difftool.useBuiltin is set to true.
- This feature flag will be used in the upcoming Git for Windows v2.11.0
- release, to allow early testers to opt-in to use the builtin difftool and
- flesh out any bugs.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: report trees as dangling
- After checking connectivity, fsck looks through the list of
- any objects we've seen mentioned, and reports unreachable
- and un-"used" ones as dangling. However, it skips any object
- which is not marked as "parsed", as that is an object that
- we _don't_ have (but that somebody mentioned).
- Since 6e454b9a3 (clear parsed flag when we free tree
- buffers, 2013-06-05), that flag can't be relied on, and the
- correct method is to check the HAS_OBJ flag. The cleanup in
- that commit missed this callsite, though. As a result, we
- would generally fail to report dangling trees.
- We never noticed because there were no tests in this area
- (for trees or otherwise). Let's add some.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t1450: clean up sub-objects in duplicate-entry test
- This test creates a multi-level set of trees, but its
- cleanup routine only removes the top-level tree. After the
- test finishes, the inner tree and the blob it points to
- remain, making the inner tree dangling.
- A later test ("cleaned up") verifies that we've removed any
- cruft and "git fsck" output is clean. This passes only
- because of a bug in git-fsck which fails to notice dangling
- trees.
- In preparation for fixing the bug, let's teach this earlier
- test to clean up after itself correctly. We have to remove
- the inner tree (and therefore the blob, too, which becomes
- dangling after removing that tree).
- Since the setup code happens inside a subshell, we can't
- just set a variable for each object. However, we can stuff
- all of the sha1s into the $T output variable, which is not
- used for anything except cleanup.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- diff: document the format of the -O (diff.orderFile) file
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- diff: document behavior of relative diff.orderFile
- Document that a relative pathname for diff.orderFile is interpreted as
- relative to the top-level work directory.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- request-pull: drop old USAGE stuff
- request-pull uses OPTIONS_SPEC, so no need for (meanwhile incomplete)
- USAGE and LONG_USAGE anymore.
- Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- xdiff -W: relax end-of-file function detection
- When adding a new function to the end of a file, it's enough to know
- that 1) the addition is at the end of the file; and 2) there is a
- function _somewhere_ in there.
- If we had simply been changing the end of an existing function, then we
- would also be deleting something from the old version.
- This fixes the case where we add e.g.
- // Begin of dummy
- static int dummy(void)
- {
- }
- to the end of the file.
- Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
- Acked-by: René Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: detect trailing garbage in all object types
- When a loose tree or commit is read by fsck (or any git
- program), unpack_sha1_rest() checks whether there is extra
- cruft at the end of the object file, after the zlib data.
- Blobs that are streamed, however, do not have this check.
- For normal git operations, it's not a big deal. We know the
- sha1 and size checked out, so we have the object bytes we
- wanted. The trailing garbage doesn't affect what we're
- trying to do.
- But since the point of fsck is to find corruption or other
- problems, it should be more thorough. This patch teaches its
- loose-sha1 reader to detect extra bytes after the zlib
- stream and complain.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fsck: parse loose object paths directly
- When we iterate over the list of loose objects to check, we
- get the actual path of each object. But we then throw it
- away and pass just the sha1 to fsck_sha1(), which will do a
- fresh lookup. Usually it would find the same object, but it
- may not if an object exists both as a loose and a packed
- object. We may end up checking the packed object twice, and
- never look at the loose one.
- In practice this isn't too terrible, because if fsck doesn't
- complain, it means you have at least one good copy. But
- since the point of fsck is to look for corruption, we should
- be thorough.
- The new read_loose_object() interface can help us get the
- data from disk, and then we replace parse_object() with
- parse_object_buffer(). As a bonus, our error messages now
- mention the path to a corrupted object, which should make it
- easier to track down errors when they do happen.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sha1_file: add read_loose_object() function
- It's surprisingly hard to ask the sha1_file code to open a
- _specific_ incarnation of a loose object. Most of the
- functions take a sha1, and loop over the various object
- types (packed versus loose) and locations (local versus
- alternates) at a low level.
- However, some tools like fsck need to look at a specific
- file. This patch gives them a function they can use to open
- the loose object at a given path.
- The implementation unfortunately ends up repeating bits of
- related functions, but there's not a good way around it
- without some major refactoring of the whole sha1_file stack.
- We need to mmap the specific file, then partially read the
- zlib stream to know whether we're streaming or not, and then
- finally either stream it or copy the data to a buffer.
- We can do that by assembling some of the more arcane
- internal sha1_file functions, but we end up having to
- essentially reimplement unpack_sha1_file(), along with the
- streaming bits of check_sha1_signature().
- Still, most of the ugliness is contained in the new
- function, and the interface is clean enough that it may be
- reusable (though it seems unlikely anything but git-fsck
- would care about opening a specific file).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t1450: test fsck of packed objects
- The code paths in fsck for packed and loose objects are
- quite different, and it is not immediately obvious that the
- packed case behaves well. In particular:
- 1. The fsck_loose() function always returns "0" to tell the
- iterator to keep checking more objects. Whereas
- fsck_obj_buffer() (which handles packed objects)
- returns -1. This is OK, because the callback machinery
- for verify_pack() does not stop when it sees a non-zero
- return.
- 2. The fsck_loose() function sets the ERROR_OBJECT bit
- when fsck_obj() fails, whereas fsck_obj_buffer() sets it
- only when it sees a corrupt object. This turns out not
- to matter. We don't actually do anything with this bit
- except exit the program with a non-zero code, and that
- is handled already by the non-zero return from the
- function.
- So there are no bugs here, but it was certainly confusing to
- me. And we do not test either of the properties in t1450
- (neither that a non-corruption error will caused a non-zero
- exit for a packed object, nor that we keep going after
- seeing the first error). Let's test both of those
- conditions, so that we'll notice if any of those assumptions
- becomes invalid.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sha1_file: fix error message for alternate objects
- When we fail to open a corrupt loose object, we report an
- error and mention the filename via sha1_file_name().
- However, that function will always give us a path in the
- local repository, whereas the corrupt object may have come
- from an alternate. The result is a very misleading error
- message.
- Teach the open_sha1_file() and stat_sha1_file() helpers to
- pass back the path they found, so that we can report it
- correctly.
- Note that the pointers we return go to static storage (e.g.,
- from sha1_file_name()), which is slightly dangerous.
- However, these helpers are static local helpers, and the
- names are used for immediately generating error messages.
- The simplicity is an acceptable tradeoff for the danger.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t1450: refactor loose-object removal
- Commit 90cf590f5 (fsck: optionally show more helpful info
- for broken links, 2016-07-17) added a remove_loose_object()
- helper, but we already had a remove_object() helper that did
- the same thing. Let's combine these into one.
- The implementations had a few subtle differences, so I've
- tried to take the best of both:
- - the original used "sed", but the newer version avoids
- spawning an extra process
- - the original processed "$*", which was nonsense, as it
- assumed only a single sha1. Use "$1" to make that more
- clear.
- - the newer version ran an extra rev-parse, but it was not
- necessary; it's sole caller already converted the
- argument into a raw sha1
- - the original used "rm -f", whereas the new one uses
- "rm". The latter is better because it may notice a bug
- or other unexpected failure in the test. (The original
- does check that the object exists before we remove it,
- which is good, but that's a subset of the possible
- unexpected conditions).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: git-gui browser does not default to HEAD
- 37cd4f7 ("Document git-gui, git-citool as mainporcelain manual pages",
- 2007-06-21) documented the default, but was shortly followed by c52c945
- ("git-gui: Allow blame/browser subcommands on bare repositories",
- 2007-07-17) which, it would appear, as a side effect, removed that default.
- Finally document that change.
- Signed-off-by: Philip Oakley <philipoakley@iee.org>
- Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: gitk: add the upstream repo location
- Match the 'git gui' information regarding the graphical browser
- and its upstream location.
- Signed-off-by: Philip Oakley <philipoakley@iee.org>
- Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: gitk: remove gitview reference
- contrib/gitview has been removed. Remove the reference.
- Signed-off-by: Philip Oakley <philipoakley@iee.org>
- Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- lib-submodule-update.sh: reduce use of subshell by using "git -C"
- We write
- (cd <dir> && git <cmd>)
- to avoid
- cd <dir> && git <cmd> && cd ..
- that allows a breakage in one part of the test script to leave the
- entire test process in an unexpected place. Modern version of Git
- allows us to do this more concisely with "git -C <dir> <cmd>".
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- builtin/commit.c: remove the PATH_MAX limitation via dynamic allocation
- Remove the PATH_MAX limitation from the environment setting that
- points to a filename by switching to dynamic allocation.
- As a side effect of this change, we also reduce the snprintf()
- calls, that may silently truncate results if the programmer is not
- careful.
- Helped-by: Junio C Hamano <gitster@pobox.com>
- Helped-by: Jeff King <peff@peff.net>
- Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Documentation/bisect: improve on (bad|new) and (good|bad)
- The following part of the description:
- git bisect (bad|new) [<rev>]
- git bisect (good|old) [<rev>...]
- may be a bit confusing, as a reader may wonder if instead it should be:
- git bisect (bad|good) [<rev>]
- git bisect (old|new) [<rev>...]
- Of course the difference between "[<rev>]" and "[<rev>...]" should hint
- that there is a good reason for the way it is.
- But we can further clarify and complete the description by adding
- "<term-new>" and "<term-old>" to the "bad|new" and "good|old"
- alternatives.
- Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- asciidoctor: fix user-manual to be built by `asciidoctor`
- The `user-manual.txt` is designed as a `book` but the `Makefile` wants
- to build it as an `article`. This seems to be a problem when building
- the documentation with `asciidoctor`. Furthermore the parts *Git
- Glossary* and *Appendix B* had no subsections which is not allowed when
- building with `asciidoctor`. So lets add a *dummy* section.
- Signed-off-by: 마누엘 <nalla@hamal.uberspace.de>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule update --init: display correct path from submodule
- In the submodule helper we did not correctly handled the display path
- for initializing submodules when both the submodule is inside a
- subdirectory as well as the command being invoked from a subdirectory
- (as viewed from the superproject).
- This was broken in 3604242f080, which was written at a time where
- there was no super-prefix available, so we abused the --prefix option
- for the same purpose and could get only one case right (the call from
- within a subdirectory, not the submodule being in a subdirectory).
- Test-provided-by: David Turner <novalis@novalis.org>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule update documentation: don't repeat ourselves
- The documentation for the `git submodule update` command, repeats itself
- for each update option, "This is done when <option> is given, or no
- option is given and `submodule.<name>.update` is set to <string>.
- Avoid these repetitive clauses by stating the command line options take
- precedence over configured options.
- Also add 'none' to the list of options instead of mentioning it in the
- following running text and split the list into two parts, one that is
- accessible via the command line and one that is only reachable via the
- configuration variables.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule documentation: add options to the subcommand
- When reading up on a subcommand of `git submodule <subcommand>`,
- it is convenient to have its options nearby and not just at the
- top of the man page. Add the options to each subcommand.
- While at it, also document the `--checkout` option for `update`.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7411: test lookup of uninitialized submodules
- Sometimes we need to lookup information of uninitialized submodules. Make
- sure that works.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7411: quote URLs
- The variables may contain white spaces, so we need to quote them.
- By not quoting the variables we'd end up passing multiple arguments to
- git config, which doesn't fail for two arguments as value.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule absorbgitdirs: mention in docstring help
- This part was missing in f6f85861 (submodule: add absorb-git-dir function,
- 2016-12-12).
- Noticed-by: Jonathan Nieder <jrnieder@gmail.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- diff: add interhunk context config option
- The --inter-hunk-context= option was added in commit 6d0e674a5754
- ("diff: add option to show context between close hunks"). This patch
- allows configuring a default for this option.
- Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- versioncmp: generalize version sort suffix reordering
- The 'versionsort.prereleaseSuffix' configuration variable, as its name
- suggests, is supposed to only deal with tagnames with prerelease
- suffixes, and allows sorting those prerelease tags in a user-defined
- order before the suffixless main release tag, instead of sorting them
- simply lexicographically.
- However, the previous changes in this series resulted in an
- interesting and useful property of version sort:
- - The empty string as a configured suffix matches all tagnames,
- including tagnames without any suffix, but
- - tagnames containing a "real" configured suffix are still ordered
- according to that real suffix, because any longer suffix takes
- precedence over the empty string.
- Exploiting this property we can easily generalize suffix reordering
- and specify the order of tags with given suffixes not only before but
- even after a main release tag by using the empty suffix to denote the
- position of the main release tag, without any algorithm changes:
- $ git -c versionsort.prereleaseSuffix=-alpha \
- -c versionsort.prereleaseSuffix=-beta \
- -c versionsort.prereleaseSuffix="" \
- -c versionsort.prereleaseSuffix=-gamma \
- -c versionsort.prereleaseSuffix=-delta \
- tag -l --sort=version:refname 'v3.0*'
- v3.0-alpha1
- v3.0-beta1
- v3.0
- v3.0-gamma1
- v3.0-delta1
- Since 'versionsort.prereleaseSuffix' is not a fitting name for a
- configuration variable to control this more general suffix reordering,
- introduce the new variable 'versionsort.suffix'. Still keep the old
- configuration variable name as a deprecated alias, though, to avoid
- suddenly breaking setups already using it. Ignore the old variable if
- both old and new configuration variables are set, but emit a warning
- so users will be aware of it and can fix their configuration. Extend
- the documentation to describe and add a test to check this more
- general behavior.
- Note: since the empty suffix matches all tagnames, tagnames with
- suffixes not included in the configuration are listed together with
- the suffixless main release tag, ordered lexicographically right after
- that, i.e. before tags with suffixes listed in the configuration
- following the empty suffix.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- versioncmp: factor out helper for suffix matching
- As the number of identical steps to be done for both tagnames grows,
- extract them into a helper function, with the additional benefit that
- the conditionals near the end of swap_prereleases() will use more
- meaningful variable names.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- vreport: sanitize ASCII control chars
- Our error() and die() calls may report messages with
- arbitrary data (e.g., filenames or even data from a remote
- server). Let's make it harder to cause confusion with
- mischievous filenames. E.g., try:
- git rev-parse "$(printf "\rfatal: this argument is too sneaky")" --
- or
- git rev-parse "$(printf "\x1b[5mblinky\x1b[0m")" --
- Let's block all ASCII control characters, with the exception
- of TAB and LF. We use both in our own messages (and we are
- necessarily sanitizing the complete output of snprintf here,
- as we do not have access to the individual varargs). And TAB
- and LF are unlikely to cause confusion (you could put
- "\nfatal: sneaky\n" in your filename, but it would at least
- not _cover up_ the message leading to it, unlike "\r").
- We'll replace the characters with a "?", which is similar to
- how "ls" behaves. It might be nice to do something less
- lossy, like converting them to "\x" hex codes. But replacing
- with a single character makes it easy to do in-place and
- without worrying about length limitations. This feature
- should kick in rarely enough that the "?" marks are almost
- never seen.
- We'll leave high-bit characters as-is, as they are likely to
- be UTF-8 (though there may be some Unicode mischief you
- could cause, which may require further patches).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Revert "vreportf: avoid intermediate buffer"
- This reverts commit f4c3edc0b156362a92bf9de4f0ec794e90a757fc.
- The purpose of that commit was to let us write errors of
- arbitrary length to stderr by skipping the intermediate
- buffer and sending our varargs straight to fprintf. That
- works, but it comes with a downside: we do not get access to
- the varargs before they are sent to stderr.
- On balance, it's not a good tradeoff. Error messages larger
- than our 4K buffer are quite uncommon, and we've lost the
- ability to make any modifications to the output (e.g., to
- remove non-printable characters).
- The only way to have both would be one of:
- 1. Write into a dynamic buffer. But this is a bad idea for
- a low-level function that may be called when malloc()
- has failed.
- 2. Do our own printf-format varargs parsing. This is too
- complex to be worth the trouble.
- Let's just revert that change and go back to a fixed buffer.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- index: improve constness for reading blob data
- Improve constness of the index_state parameter to the
- 'read_blob_data_from_index' function.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t1001: modernize style
- The preferred style in tests is:
- test_expect_success 'short description then sq to open the body' '
- here comes the test &&
- and chains over many lines &&
- with closing sq on its own line
- '
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t1000: modernize style
- The preferred style in tests is:
- test_expect_success 'short description then sq to open the body' '
- here comes the test &&
- and chains over many lines &&
- with closing sq on its own line
- '
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- read-tree: use OPT_BOOL instead of OPT_SET_INT
- All occurrences of OPT_SET_INT were setting the value to 1;
- internally OPT_BOOL is just that.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7810: avoid assumption about invalid regex syntax
- A few of the tests want to check that "git grep -P -E" will
- override -P with -E, and vice versa. To do so, we use a
- regex with "\x{..}", which is valid in PCRE but not defined
- by POSIX (for basic or extended regular expressions).
- However, POSIX declares quite a lot of syntax, including
- "\x", as "undefined". That leaves implementations free to
- extend the standard if they choose. At least one, musl libc,
- implements "\x" in the same way as PCRE. Our tests check
- that "-E" complains about "\x", which fails with musl.
- We can fix this by finding some construct which behaves
- reliably on both PCRE and POSIX, but differently in each
- system.
- One such construct is the use of backslash inside brackets.
- In PCRE, "[\d]" interprets "\d" as it would outside the
- brackets, matching a digit. Whereas in POSIX, the backslash
- must be treated literally, and we match either it or a
- literal "d". Moreover, implementations are not free to
- change this according to POSIX, so we should be able to rely
- on it.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Fifth batch 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'sb/submodule-embed-gitdir'
- A new submodule helper "git submodule embedgitdirs" to make it
- easier to move embedded .git/ directory for submodules in a
- superproject to .git/modules/ (and point the latter with the former
- that is turned into a "gitdir:" file) has been added.
- * sb/submodule-embed-gitdir:
- worktree: initialize return value for submodule_uses_worktrees
- submodule: add absorb-git-dir function
- move connect_work_tree_and_git_dir to dir.h
- worktree: check if a submodule uses worktrees
- test-lib-functions.sh: teach test_commit -C <dir>
- submodule helper: support super prefix
- submodule: use absolute path for computing relative path connecting
- Merge branch 'jc/retire-compaction-heuristics'
- "git diff" and its family had two experimental heuristics to shift
- the contents of a hunk to make the patch easier to read. One of
- them turns out to be better than the other, so leave only the
- "--indent-heuristic" option and remove the other one.
- * jc/retire-compaction-heuristics:
- diff: retire "compaction" heuristics
- Merge branch 'nd/config-misc-fixes'
- Leakage of lockfiles in the config subsystem has been fixed.
- * nd/config-misc-fixes:
- config.c: handle lock file in error case in git_config_rename_...
- config.c: rename label unlock_and_out
- config.c: handle error case for fstat() calls
- Merge branch 'jc/abbrev-autoscale-config'
- Recent update to the default abbreviation length that auto-scales
- lacked documentation update, which has been corrected.
- * jc/abbrev-autoscale-config:
- config.abbrev: document the new default that auto-scales
- Merge branch 'mh/fast-import-notes-fix-new'
- "git fast-import" sometimes mishandled while rebalancing notes
- tree, which has been fixed.
- * mh/fast-import-notes-fix-new:
- fast-import: properly fanout notes when tree is imported
- Merge branch 'jc/git-open-cloexec'
- The codeflow of setting NOATIME and CLOEXEC on file descriptors Git
- opens has been simplified.
- We may want to drop the tip one, but we'll see.
- * jc/git-open-cloexec:
- sha1_file: stop opening files with O_NOATIME
- git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback
- git_open(): untangle possible NOATIME and CLOEXEC interactions
- Merge branch 'jc/compression-config'
- Compression setting for producing packfiles were spread across
- three codepaths, one of which did not honor any configuration.
- Unify these so that all of them honor core.compression and
- pack.compression variables the same way.
- * jc/compression-config:
- compression: unify pack.compression configuration parsing
- Merge branch 'dt/smart-http-detect-server-going-away'
- When the http server gives an incomplete response to a smart-http
- rpc call, it could lead to client waiting for a full response that
- will never come. Teach the client side to notice this condition
- and abort the transfer.
- An improvement counterproposal has failed.
- cf. <20161114194049.mktpsvgdhex2f4zv@sigill.intra.peff.net>
- * dt/smart-http-detect-server-going-away:
- upload-pack: optionally allow fetching any sha1
- remote-curl: don't hang when a server dies before any output
- Merge branch 'mm/gc-safety-doc'
- Doc update.
- * mm/gc-safety-doc:
- git-gc.txt: expand discussion of races with other processes
- Merge branch 'mm/push-social-engineering-attack-doc'
- Doc update on fetching and pushing.
- * mm/push-social-engineering-attack-doc:
- doc: mention transfer data leaks in more places
- Merge branch 'jt/fetch-no-redundant-tag-fetch-map'
- Code cleanup to avoid using redundant refspecs while fetching with
- the --tags option.
- * jt/fetch-no-redundant-tag-fetch-map:
- fetch: do not redundantly calculate tag refmap
- Merge branch 'jc/latin-1'
- Some platforms no longer understand "latin-1" that is still seen in
- the wild in e-mail headers; replace them with "iso-8859-1" that is
- more widely known when conversion fails from/to it.
- * jc/latin-1:
- utf8: accept "latin-1" as ISO-8859-1
- utf8: refactor code to decide fallback encoding
- mergetool: fix running in subdir when rerere enabled
- "git mergetool" (without any pathspec on the command line) that is
- not run from the top-level of the working tree no longer works in
- Git v2.11, failing to get the list of unmerged paths from the output
- of "git rerere remaining". This regression was introduced by
- 57937f70a0 ("mergetool: honor diff.orderFile", 2016-10-07).
- This is because the pathnames output by the 'git rerere remaining'
- command are relative to the top-level directory but the 'git diff
- --name-only' command expects its pathname arguments to be relative
- to the current working directory. To make everything consistent,
- cd_to_toplevel before running 'git diff --name-only' and adjust any
- relative pathnames.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mergetool: take the "-O" out of $orderfile
- This will make it easier for a future commit to convert a relative
- orderfile pathname to either absolute or relative to the top-level
- directory. It also improves code readability.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: add test case for rerere+mergetool+subdir bug
- If rerere is enabled and mergetool is run from a subdirectory,
- mergetool always prints "No files need merging". Add an expected
- failure test case for this situation.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: spell 'git reset --hard' consistently
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: don't assume the checked-out commit
- Always check out the required commit at the beginning of the test so
- that a failure in a previous test does not cause the test to work off
- of the wrong commit.
- This is a step toward making the tests more independent so that if one
- test fails it doesn't cause subsequent tests to fail.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: always work on a test-specific branch
- Create and use a test-specific branch when the test might create a
- commit. This is not always necessary for correctness, but it improves
- debuggability by ensuring a commit created by test #N shows up on the
- testN branch, not the branch for test #N-1.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: delete some now-unnecessary 'git reset --hard' lines
- Tests now always run 'git reset --hard' at the end (even if they
- fail), so it's no longer necessary to run 'git reset --hard' at the
- beginning of a test.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: run 'git reset --hard' after each test to clean up
- Use test_when_finished to run 'git reset --hard' after each test so
- that the repository is left in a saner state for the next test.
- This is a step toward making the tests more independent so that if one
- test fails it doesn't cause subsequent tests to fail.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: don't rely on state from previous test
- If the repository must be in a particular state (beyond what is
- already done by the 'setup' test case) before the test can run, make
- the necessary repository changes in the test script even if it means
- duplicating some lines of code from the previous test case.
- This is a step toward making the tests more independent so that if one
- test fails it doesn't cause subsequent tests to fail.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: use test_when_finished for cleanup tasks
- This is a step toward making the tests more independent so that if one
- test fails it doesn't cause subsequent tests to fail.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: move setup code to the 'setup' test case
- Multiple test cases depend on these hunks, so move them to the 'setup'
- test case. This is a step toward making the tests more independent so
- that if one test fails it doesn't cause subsequent tests to fail.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7610: update branch names to match test number
- Rename the testNN branches so that NN matches the test number. This
- should make it easier to troubleshoot test issues. Use $test_count to
- keep this future-proof.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rev-parse doc: pass "--" to rev-parse in the --prefix example
- The "--" argument avoids "ambiguous argument: unknown revision or
- path not in the working tree" errors when a pathname argument refers
- to a non-existent file.
- The "--" passed explicitly to set was removed because rev-parse
- outputs the "--" argument that it is given.
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: Do not abruptly die when using the 'lstrip=<N>' option
- Currently when we use the 'lstrip=<N>' option, if 'N' is greater than
- the number of components available in the refname, we abruptly end
- program execution by calling die().
- This behavior is undesired since a single refname with few components
- could end program execution. To avoid this, return an empty string
- whenever the value 'N' is greater than the number of components
- available, instead of calling die().
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: rename the 'strip' option to 'lstrip'
- In preparation for the upcoming patch, where we introduce the 'rstrip'
- option. Rename the 'strip' option to 'lstrip' to remove ambiguity.
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
- Use the recently introduced refname_atom_parser_internal() within
- remote_ref_atom_parser(), this provides a common base for all the ref
- printing atoms, allowing %(upstream) and %(push) to also use the
- ':strip' option.
- The atoms '%(push)' and '%(upstream)' will retain the ':track' and
- ':trackshort' atom modifiers to themselves as they have no meaning in
- context to the '%(refname)' and '%(symref)' atoms.
- Update the documentation and tests to reflect the same.
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: introduce refname_atom_parser()
- Using refname_atom_parser_internal(), introduce refname_atom_parser()
- which will parse the %(symref) and %(refname) atoms. Store the parsed
- information into the 'used_atom' structure based on the modifiers used
- along with the atoms.
- Now the '%(symref)' atom supports the ':strip' atom modifier. Update the
- Documentation and tests to reflect this.
- Helped-by: Jeff King <peff@peff.net>
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: introduce refname_atom_parser_internal()
- Since there are multiple atoms which print refs ('%(refname)',
- '%(symref)', '%(push)', '%(upstream)'), it makes sense to have a common
- ground for parsing them. This would allow us to share implementations of
- the atom modifiers between these atoms.
- Introduce refname_atom_parser_internal() to act as a common parsing
- function for ref printing atoms. This would eventually be used to
- introduce refname_atom_parser() and symref_atom_parser() and also be
- internally used in remote_ref_atom_parser().
- Helped-by: Jeff King <peff@peff.net>
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: make "%(symref)" atom work with the ':short' modifier
- The "%(symref)" atom doesn't work when used with the ':short' modifier
- because we strictly match only 'symref' for setting the 'need_symref'
- indicator. Fix this by comparing with the valid_atom rather than the
- used_atom.
- Add tests for %(symref) and %(symref:short) while we're here.
- Helped-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: add support for %(upstream:track,nobracket)
- Add support for %(upstream:track,nobracket) which will print the
- tracking information without the brackets (i.e. "ahead N, behind M").
- This is needed when we port branch.c to use ref-filter's printing APIs.
- Add test and documentation for the same.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
- Borrowing from branch.c's implementation print "[gone]" whenever an
- unknown upstream ref is encountered instead of just ignoring it.
- This makes sure that when branch.c is ported over to using ref-filter
- APIs for printing, this feature is not lost.
- Make changes to t/t6300-for-each-ref.sh and
- Documentation/git-for-each-ref.txt to reflect this change.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Helped-by : Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: introduce format_ref_array_item()
- To allow column display, we will need to first render the output in a
- string list to allow print_columns() to compute the proper size of
- each column before starting the actual output. Introduce the function
- format_ref_array_item() that does the formatting of a ref_array_item
- to an strbuf.
- show_ref_array_item() is kept as a convenience wrapper around it which
- obtains the strbuf and prints it the standard output.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: move get_head_description() from branch.c
- Move the implementation of get_head_description() from branch.c to
- ref-filter. This gives a description of the HEAD ref if called. This
- is used as the refname for the HEAD ref whenever the
- FILTER_REFS_DETACHED_HEAD option is used. Make it public because we
- need it to calculate the length of the HEAD refs description in
- branch.c:calc_maxwidth() when we port branch.c to use ref-filter
- APIs.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: modify "%(objectname:short)" to take length
- Add support for %(objectname:short=<length>) which would print the
- abbreviated unique objectname of given length. When no length is
- specified, the length is 'DEFAULT_ABBREV'. The minimum length is
- 'MINIMUM_ABBREV'. The length may be exceeded to ensure that the
- provided object name is unique.
- Add tests and documentation for the same.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Helped-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
- Implement %(if:equals=<string>) wherein the if condition is only
- satisfied if the value obtained between the %(if:...) and %(then) atom
- is the same as the given '<string>'.
- Similarly, implement (if:notequals=<string>) wherein the if condition
- is only satisfied if the value obtained between the %(if:...) and
- %(then) atom is different from the given '<string>'.
- This is done by introducing 'if_atom_parser()' which parses the given
- %(if) atom and then stores the data in used_atom which is later passed
- on to the used_atom of the %(then) atom, so that it can do the required
- comparisons.
- Add tests and documentation for the same.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: include reference to 'used_atom' within 'atom_value'
- Ensure that each 'atom_value' has a reference to its corresponding
- 'used_atom'. This lets us use values within 'used_atom' in the
- 'handler' function.
- Hence we can get the %(align) atom's parameters directly from the
- 'used_atom' therefore removing the necessity of passing %(align) atom's
- parameters to 'atom_value'.
- This also acts as a preparatory patch for the upcoming patch where we
- introduce %(if:equals=) and %(if:notequals=).
- Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ref-filter: implement %(if), %(then), and %(else) atoms
- Implement %(if), %(then) and %(else) atoms. Used as
- %(if)...%(then)...%(end) or %(if)...%(then)...%(else)...%(end). If the
- format string between %(if) and %(then) expands to an empty string, or
- to only whitespaces, then the whole %(if)...%(end) expands to the string
- following %(then). Otherwise, it expands to the string following
- %(else), if any. Nesting of this construct is possible.
- This is in preparation for porting over `git branch -l` to use
- ref-filter APIs for printing.
- Add documentation and tests regarding the same.
- Mentored-by: Christian Couder <christian.couder@gmail.com>
- Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- unpack-trees: factor progress setup out of check_updates
- This makes check_updates shorter and easier to understand.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- unpack-trees: remove unneeded continue
- The continue is the last statement in the loop, so not needed.
- This situation arose in 700e66d66 (2010-07-30, unpack-trees: let
- read-tree -u remove index entries outside sparse area) when statements
- after the continue were removed.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- unpack-trees: move checkout state into check_updates
- The checkout state was introduced via 16da134b1f9
- (read-trees: refactor the unpack_trees() part, 2006-07-30). An attempt to
- refactor the checkout state was done in b56aa5b268e (unpack-trees: pass
- checkout state explicitly to check_updates(), 2016-09-13), but we can
- go even further.
- The `struct checkout state` is not used in unpack_trees apart from
- initializing it, so move it into the function that makes use of it,
- which is `check_updates`.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Reviewed-by: René Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- .mailmap: record canonical email for Richard Hansen
- When I changed employers my work address changed from rhansen@bbn.com
- to hansenr@google.com. Rather than map my old work address to my new,
- map them both to my permanent personal email address. (I will still
- use my work address in commits I submit so that my employer gets some
- credit.)
- Signed-off-by: Richard Hansen <hansenr@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: give better message for submodule related pathspec error
- Every once in a while someone complains to the mailing list to have
- run into this weird assertion[1]. The usual response from the mailing
- list is link to old discussions[2], and acknowledging the problem
- stating it is known.
- This patch accomplishes two things:
- 1. Switch assert() to die("BUG") to give a more readable message.
- 2. Take one of the cases where we hit a BUG and turn it into a normal
- "there was something wrong with the input" message.
- This assertion triggered for cases where there wasn't a programming
- bug, but just bogus input. In particular, if the user asks for a
- pathspec that is inside a submodule, we shouldn't assert() or
- die("BUG"); we should tell the user their request is bogus.
- The only reason we did not check for it, is the expensive nature
- of such a check, so callers avoid setting the flag
- PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE. However when we die due
- to bogus input, the expense of CPU cycles spent outweighs the user
- wondering what went wrong, so run that check unconditionally before
- dying with a more generic error message.
- Note: There is a case (e.g. "git -C submodule add .") in which we call
- strip_submodule_slash_expensive, as git-add requests it via the flag
- PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE, but the assert used to
- trigger nevertheless, because the flag PATHSPEC_LITERAL was not set,
- such that we executed
- if (item->nowildcard_len < prefixlen)
- item->nowildcard_len = prefixlen;
- and prefixlen was not adapted (e.g. it was computed from "submodule/")
- So in the die_inside_submodule_path function we also need handle paths,
- that were stripped before, i.e. are the exact submodule path. This
- is why the conditions in die_inside_submodule_path are slightly
- different than in strip_submodule_slash_expensive.
- [1] https://www.google.com/search?q=item-%3Enowildcard_len
- [2] http://git.661346.n2.nabble.com/assert-failed-in-submodule-edge-case-td7628687.html
- https://www.spinics.net/lists/git/msg249473.html
- Helped-by: Jeff King <peff@peff.net>
- Helped-by: Junio C Hamano <gitster@pobox.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): differentiate between comments and 'noop'
- In the upcoming patch, we will support rebase -i's progress
- reporting. The progress skips comments but counts 'noop's.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): implement the 'drop' command
- The parsing part of a 'drop' command is almost identical to parsing a
- 'pick', while the operation is the same as that of a 'noop'.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): allow rescheduling commands
- The interactive rebase has the very special magic that a cherry-pick
- that exits with a status different from 0 and 1 signifies a failure to
- even record that a cherry-pick was started.
- This can happen e.g. when a fast-forward fails because it would
- overwrite untracked files.
- In that case, we must reschedule the command that we thought we already
- had at least started successfully.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): respect strategy/strategy_opts settings
- The sequencer already has an idea about using different merge
- strategies. We just piggy-back on top of that, using rebase -i's
- own settings, when running the sequencer in interactive rebase mode.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): respect the rebase.autostash setting
- Git's `rebase` command inspects the `rebase.autostash` config setting
- to determine whether it should stash any uncommitted changes before
- rebasing and re-apply them afterwards.
- As we introduce more bits and pieces to let the sequencer act as
- interactive rebase's backend, here is the part that adds support for
- the autostash feature.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): run the post-rewrite hook, if needed
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): record interrupted commits in rewritten, too
- When continuing after a `pick` command failed, we want that commit
- to show up in the rewritten-list (and its notes to be rewritten), too.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): copy commit notes at end
- When rebasing commits that have commit notes attached, the interactive
- rebase rewrites those notes faithfully at the end. The sequencer must
- do this, too, if it wishes to do interactive rebase's job.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): set the reflog message consistently
- We already used the same reflog message as the scripted version of rebase
- -i when finishing. With this commit, we do that also for all the commands
- before that.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): refactor setting the reflog message
- This makes the code DRYer, with the obvious benefit that we can enhance
- the code further in a single place.
- We can also reuse the functionality elsewhere by calling this new
- function.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): allow fast-forwarding for edit/reword
- The sequencer already knew how to fast-forward instead of
- cherry-picking, if possible.
- We want to continue to do this, of course, but in case of the 'reword'
- command, we will need to call `git commit` after fast-forwarding.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): implement the 'reword' command
- This is now trivial, as all the building blocks are in place: all we need
- to do is to flip the "edit" switch when committing.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): leave a patch upon error
- When doing an interactive rebase, we want to leave a 'patch' file for
- further inspection by the user (even if we never tried to actually apply
- that patch, since we're cherry-picking instead).
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): update refs after a successful rebase
- An interactive rebase operates on a detached HEAD (to keep the reflog
- of the original branch relatively clean), and updates the branch only
- at the end.
- Now that the sequencer learns to perform interactive rebases, it also
- needs to learn the trick to update the branch before removing the
- directory containing the state of the interactive rebase.
- We introduce a new head_ref variable in a wider scope than necessary at
- the moment, to allow for a later patch that prints out "Successfully
- rebased and updated <ref>".
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): the todo can be empty when continuing
- When the last command of an interactive rebase fails, the user needs to
- resolve the problem and then continue the interactive rebase. Naturally,
- the todo script is empty by then. So let's not complain about that!
- To that end, let's move that test out of the function that parses the
- todo script, and into the more high-level function read_populate_todo().
- This is also necessary by now because the lower-level parse_insn_buffer()
- has no idea whether we are performing an interactive rebase or not.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): skip some revert/cherry-pick specific code path
- When a cherry-pick continues without a "todo script", the intention is
- simply to pick a single commit.
- However, when an interactive rebase is continued without a "todo
- script", it means that the last command has been completed and that we
- now need to clean up.
- This commit guards the revert/cherry-pick specific steps so that they
- are not executed in rebase -i mode.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): remove CHERRY_PICK_HEAD when no longer needed
- The scripted version of the interactive rebase already does that.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): allow continuing with staged changes
- When an interactive rebase is interrupted, the user may stage changes
- before continuing, and we need to commit those changes in that case.
- Please note that the nested "if" added to the sequencer_continue() is
- not combined into a single "if" because it will be extended with an
- "else" clause in a later patch in this patch series.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): write an author-script file
- When the interactive rebase aborts, it writes out an author-script file
- to record the author information for the current commit. As we are about
- to teach the sequencer how to perform the actions behind an interactive
- rebase, it needs to write those author-script files, too.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): implement the short commands
- For users' convenience, most rebase commands can be abbreviated, e.g.
- 'p' instead of 'pick' and 'x' instead of 'exec'. Let's teach the
- sequencer to handle those abbreviated commands just fine.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): add support for the 'fixup' and 'squash' commands
- This is a huge patch, and at the same time a huge step forward to
- execute the performance-critical parts of the interactive rebase in a
- builtin command.
- Since 'fixup' and 'squash' are not only similar, but also need to know
- about each other (we want to reduce a series of fixups/squashes into a
- single, final commit message edit, from the user's point of view), we
- really have to implement them both at the same time.
- Most of the actual work is done by the existing code path that already
- handles the "pick" and the "edit" commands; We added support for other
- features (e.g. to amend the commit message) in the patches leading up to
- this one, yet there are still quite a few bits in this patch that simply
- would not make sense as individual patches (such as: determining whether
- there was anything to "fix up" in the "todo" script, etc).
- In theory, it would be possible to reuse the fast-forward code path also
- for the fixup and the squash code paths, but in practice this would make
- the code less readable. The end result cannot be fast-forwarded anyway,
- therefore let's just extend the cherry-picking code path for now.
- Since the sequencer parses the entire `git-rebase-todo` script in one go,
- fixup or squash commands without a preceding pick can be reported early
- (in git-rebase--interactive, we could only report such errors just before
- executing the fixup/squash).
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): write the 'done' file
- In the interactive rebase, commands that were successfully processed are
- not simply discarded, but appended to the 'done' file instead. This is
- used e.g. to display the current state to the user in the output of
- `git status` or the progress.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): learn about the 'verbose' mode
- When calling `git rebase -i -v`, the user wants to see some statistics
- after the commits were rebased. Let's show some.
- The strbuf we use to perform that task will be used for other things
- in subsequent commits, hence it is declared and initialized in a wider
- scope than strictly needed here.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): implement the 'exec' command
- The 'exec' command is a little special among rebase -i's commands, as it
- does *not* have a SHA-1 as first parameter. Instead, everything after the
- `exec` command is treated as command-line to execute.
- Let's reuse the arg/arg_len fields of the todo_item structure (which hold
- the oneline for pick/edit commands) to point to the command-line.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): implement the 'edit' command
- This patch is a straight-forward reimplementation of the `edit`
- operation of the interactive rebase command.
- Well, not *quite* straight-forward: when stopping, the `edit`
- command wants to write the `patch` file (which is not only the
- patch, but includes the commit message and author information). To
- that end, this patch requires the earlier work that taught the
- log-tree machinery to respect the `file` setting of
- rev_info->diffopt to write to a file stream different than stdout.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer (rebase -i): implement the 'noop' command
- The 'noop' command is probably the most boring of all rebase -i commands
- to support in the sequencer.
- Which makes it an excellent candidate for this first stab to add support
- for rebase -i's commands to the sequencer.
- For the moment, let's also treat empty lines and commented-out lines as
- 'noop'; We will refine that handling later in this patch series.
- To make it easier to identify "classes" of todo_commands (such as:
- determine whether a command is pick-like, i.e. handles a single commit),
- let's enforce a certain order of said commands.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer: support a new action: 'interactive rebase'
- This patch introduces a new action for the sequencer. It really does not
- do a whole lot of its own right now, but lays the ground work for
- patches to come. The intention, of course, is to finally make the
- sequencer the work horse of the interactive rebase (the original idea
- behind the "sequencer" concept).
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer: use a helper to find the commit message
- It is actually not safe to look for a commit message by looking for the
- first empty line and skipping it.
- The find_commit_subject() function looks more carefully, so let's use
- it. Since we are interested in the entire commit message, we re-compute
- the string length after verifying that the commit subject is not empty
- (in which case the entire commit message would be empty, something that
- should not happen but that we want to handle gracefully).
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer: move "else" keyword onto the same line as preceding brace
- It is the current coding style of the Git project to write
- if (...) {
- ...
- } else {
- ...
- }
- instead of putting the closing brace and the "else" keyword on separate
- lines.
- Pointed out by Junio Hamano.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer: avoid unnecessary curly braces
- This was noticed while addressing Junio Hamano's concern that some
- "else" operators were on separate lines than the preceding closing
- brace.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- execv_dashed_external: wait for child on signal death
- When you hit ^C to interrupt a git command going to a pager,
- this usually leaves the pager running. But when a dashed
- external is in use, the pager ends up in a funny state and
- quits (but only after eating one more character from the
- terminal!). This fixes it.
- Explaining the reason will require a little background.
- When git runs a pager, it's important for the git process to
- hang around and wait for the pager to finish, even though it
- has no more data to feed it. This is because git spawns the
- pager as a child, and thus the git process is the session
- leader on the terminal. After it dies, the pager will finish
- its current read from the terminal (eating the one
- character), and then get EIO trying to read again.
- When you hit ^C, that sends SIGINT to git and to the pager,
- and it's a similar situation. The pager ignores it, but the
- git process needs to hang around until the pager is done. We
- addressed that long ago in a3da882120 (pager: do
- wait_for_pager on signal death, 2009-01-22).
- But when you have a dashed external (or an alias pointing to
- a builtin, which will re-exec git for the builtin), there's
- an extra process in the mix. For instance, running:
- $ git -c alias.l=log l
- will end up with a process tree like:
- git (parent)
- \
- git-log (child)
- \
- less (pager)
- If you hit ^C, SIGINT goes to all of them. The pager ignores
- it, and the child git process will end up in wait_for_pager().
- But the parent git process will die, and the usual EIO
- trouble happens.
- So we really want the parent git process to wait_for_pager(),
- but of course it doesn't know anything about the pager at
- all, since it was started by the child. However, we can
- have it wait on the git-log child, which in turn is waiting
- on the pager. And that's what this patch does.
- There are a few design decisions here worth explaining:
- 1. The new feature is attached to run-command's
- clean_on_exit feature. Partly this is convenience,
- since that feature already has a signal handler that
- deals with child cleanup.
- But it's also a meaningful connection. The main reason
- that dashed externals use clean_on_exit is to bind the
- two processes together. If somebody kills the parent
- with a signal, we propagate that to the child (in this
- instance with SIGINT, we do propagate but it doesn't
- matter because the original signal went to the whole
- process group). Likewise, we do not want the parent
- to go away until the child has done so.
- In a traditional Unix world, we'd probably accomplish
- this binding by just having the parent execve() the
- child directly. But since that doesn't work on Windows,
- everything goes through run_command's more spawn-like
- interface.
- 2. We do _not_ automatically waitpid() on any
- clean_on_exit children. For dashed externals this makes
- sense; we know that the parent is doing nothing but
- waiting for the child to exit anyway. But with other
- children, it's possible that the child, after getting
- the signal, could be waiting on the parent to do
- something (like closing a descriptor). If we were to
- wait on such a child, we'd end up in a deadlock. So
- this errs on the side of caution, and lets callers
- enable the feature explicitly.
- 3. When we send children the cleanup signal, we send all
- the signals first, before waiting on any children. This
- is to avoid the case where one child might be waiting
- on another one to exit, causing a deadlock. We inform
- all of them that it's time to die before reaping any.
- In practice, there is only ever one dashed external run
- from a given process, so this doesn't matter much now.
- But it future-proofs us if other callers start using
- the wait_after_clean mechanism.
- There's no automated test here, because it would end up racy
- and unportable. But it's easy to reproduce the situation by
- running the log command given above and hitting ^C.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- execv_dashed_external: stop exiting with negative code
- When we try to exec a git sub-command, we pass along the
- status code from run_command(). But that may return -1 if we
- ran into an error with pipe() or execve(). This tends to
- work (and end up as 255 due to twos-complement wraparound
- and truncation), but in general it's probably a good idea to
- avoid negative exit codes for portability.
- We can easily translate to the normal generic "128" code we
- get when syscalls cause us to die.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- execv_dashed_external: use child_process struct
- When we run a dashed external, we use the one-liner
- run_command_v_opt() to do so. Let's switch to using a
- child_process struct, which has two advantages:
- 1. We can drop all of the allocation and cleanup code for
- building our custom argv array, and just rely on the
- builtin argv_array (at the minor cost of doing a few
- extra mallocs).
- 2. We have access to the complete range of child_process
- options, not just the ones that the "_opt()" form can
- forward.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- real_path: set errno when max number of symlinks is exceeded
- Set errno to ELOOP when the maximum number of symlinks is exceeded, as
- would be done by other symlink-resolving functions.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- real_path: prevent redefinition of MAXSYMLINKS
- The macro 'MAXSYMLINKS' is already defined on macOS and Linux in
- <sys/param.h>. If 'MAXSYMLINKS' has already been defined, use the value
- defined by the OS otherwise default to a value of 32 which is more
- inline with what is allowed by many systems.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Makefile: put LIBS after LDFLAGS for imap-send
- This matches up with the targets git-%, git-http-fetch, git-http-push
- and git-remote-testsvn. It must be done this way in Cygwin else lcrypto
- cannot find lgdi32 and lws2_32.
- Signed-off-by: Steven Penny <svnpenn@gmail.com>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Makefile: POSIX windres
- When environment variable POSIXLY_CORRECT is set, the
- "input -o output" syntax is not supported.
- http://cygwin.com/ml/cygwin/2017-01/msg00036.html
- Use "-i input -o output" syntax instead.
- Signed-off-by: Steven Penny <svnpenn@gmail.com>
- Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t9813: avoid using pipes
- 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>
- git_exec_path: do not return the result of getenv()
- The result of getenv() is not guaranteed by POSIX to last
- beyond another call to getenv(), or setenv(), etc. We
- should duplicate the string before returning to the caller
- to avoid any surprises.
- We already keep a cached pointer to avoid repeatedly leaking
- the result of system_path(). We can use the same pointer
- here to avoid allocating and leaking for each call.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: rename prefix_pathspec to init_pathspec_item
- Give a more relevant name to the prefix_pathspec function as it does
- more than just prefix a pathspec element.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: small readability changes
- A few small changes to improve readability. This is done by grouping related
- assignments, adding blank lines, ensuring lines are <80 characters, and
- adding additional comments.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: create strip submodule slash helpers
- Factor out the logic responsible for stripping the trailing slash on
- pathspecs referencing submodules into its own function.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: create parse_element_magic helper
- Factor out the logic responsible for the magic in a pathspec element
- into its own function.
- Also avoid calling into the parsing functions when
- `PATHSPEC_LITERAL_PATH` is specified since it causes magic to be
- ignored and all paths to be treated as literals.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: create parse_long_magic function
- Factor out the logic responsible for parsing long magic into its own
- function. As well as hoist the prefix check logic outside of the inner
- loop as there isn't anything that needs to be done after matching
- "prefix:".
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: create parse_short_magic function
- Factor out the logic responsible for parsing short magic into its own
- function.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: factor global magic into its own function
- Create helper functions to read the global magic environment variables
- in additon to factoring out the global magic gathering logic into its
- own function.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: simpler logic to prefix original pathspec elements
- The logic used to prefix an original pathspec element with 'prefix'
- magic is more general purpose and can be used for more than just short
- magic. Remove the extra code paths and rename 'prefix_short_magic' to
- 'prefix_magic' to better indicate that it can be used in more general
- situations.
- Also, slightly change the logic which decides when to prefix the
- original element in order to prevent a pathspec of "." from getting
- converted to "" (empty string).
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: always show mnemonic and name in unsupported_magic
- For better clarity, always show the mnemonic and name of the unsupported
- magic being used. This lets users have a more clear understanding of
- what magic feature isn't supported. And if they supplied a mnemonic,
- the user will be told what its corresponding name is which will allow
- them to more easily search the man pages for that magic type.
- This also avoids passing an extra parameter around the pathspec
- initialization code.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: remove unused variable from unsupported_magic
- Removed unused variable 'n' from the 'unsupported_magic()' function.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: copy and free owned memory
- The 'original' string entry in a pathspec_item is only duplicated some
- of the time, instead always make a copy of the original and take
- ownership of the memory.
- Since both 'match' and 'original' string entries in a pathspec_item are
- owned by the pathspec struct, they need to be freed when clearing the
- pathspec struct (in 'clear_pathspec()') and duplicated when copying the
- pathspec struct (in 'copy_pathspec()').
- Also change the type of 'match' and 'original' to 'char *' in order to
- more explicitly show the ownership of the memory.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pathspec: remove the deprecated get_pathspec function
- Now that all callers of the old 'get_pathspec' interface have been
- migrated to use the new pathspec struct interface it can be removed
- from the codebase.
- Since there are no more users of the '_raw' field in the pathspec struct
- it can also be removed. This patch also removes the old functionality
- of modifying the const char **argv array that was passed into
- parse_pathspec. Instead the constructed 'match' string (which is a
- pathspec element with the prefix prepended) is only stored in its
- corresponding pathspec_item entry.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- ls-tree: convert show_recursive to use the pathspec struct interface
- Convert 'show_recursive()' to use the pathspec struct interface from
- using the '_raw' entry in the pathspec struct.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- dir: convert fill_directory to use the pathspec struct interface
- Convert 'fill_directory()' to use the pathspec struct interface from
- using the '_raw' entry in the pathspec struct.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- dir: remove struct path_simplify
- Teach simplify_away() and exclude_matches_pathspec() to handle struct
- pathspec directly, eliminating the need for the struct path_simplify.
- Also renamed the len parameter to pathlen in exclude_matches_pathspec()
- to match the parameter names used in simplify_away().
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mv: remove use of deprecated 'get_pathspec()'
- Convert the 'internal_copy_pathspec()' function to 'prefix_path()'
- instead of using the deprecated 'get_pathspec()' interface. Also,
- rename 'internal_copy_pathspec()' to 'internal_prefix_pathspec()' to be
- more descriptive of what the funciton is actually doing.
- In addition to this, fix a memory leak caused by only duplicating some
- of the pathspec elements. Instead always duplicate all of the the
- pathspec elements as an intermediate step (with modificationed based on
- the passed in flags). This way the intermediate strings can then be
- freed after getting the result from 'prefix_path()'.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git_exec_path: avoid Coverity warning about unfree()d result
- Technically, it is correct that git_exec_path() returns a possibly
- malloc()ed string returned from system_path(), and it is sometimes
- not allocated. Cache the result in a static variable and make sure
- that we call system_path() only once, which plugs a potential leak.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- blame: output porcelain "previous" header for each file
- It's possible for content currently found in one file to
- have originated in two separate files, each of which may
- have been modified in some single older commit. The
- --porcelain output generates an incorrect "previous" header
- in this case, whereas --line-porcelain gets it right. The
- problem is that the porcelain output tries to omit repeated
- details of commits, and treats "previous" as a property of
- the commit, when it is really a property of the blamed block
- of lines.
- Let's look at an example. In a case like this, you might see
- this output from --line-porcelain:
- SOME_SHA1 1 1 1
- author ...
- committer ...
- previous SOME_SHA1^ file_one
- filename file_one
- ...some line content...
- SOME_SHA1 2 1 1
- author ...
- committer ...
- previous SOME_SHA1^ file_two
- filename file_two
- ...some different content....
- The "filename" fields tell us that the two lines are from
- two different files. But notice that the filename also
- appears in the "previous" field, which tells us where to
- start a re-blame. The second content line never appeared in
- file_one at all, so we would obviously need to re-blame from
- file_two (or possibly even some other file, if had just been
- renamed to file_two in SOME_SHA1).
- So far so good. Now here's what --porcelain looks like:
- SOME_SHA1 1 1 1
- author ...
- committer ...
- previous SOME_SHA1^ file_one
- filename file_one
- ...some line content...
- SOME_SHA1 2 1 1
- filename file_two
- ...some different content....
- We've dropped the author and committer fields from the
- second line, as they would just be repeats. But we can't
- omit "filename", because it depends on the actual block of
- blamed lines, not just the commit. This is handled by
- emit_porcelain_details(), which will show the filename
- either if it is the first mention of the commit _or_ if the
- commit has multiple paths in it.
- But we don't give "previous" the same handling. It's written
- inside emit_one_suspect_detail(), which bails early if we've
- already seen that commit. And so the output above is wrong;
- a reader would assume that the correct place to re-blame
- line two is from file_one, but that's obviously nonsense.
- Let's treat "previous" the same as "filename", and show it
- fresh whenever we know we are in a confusing case like this.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- blame: handle --no-abbrev
- You can already ask blame for full sha1s with "-l" or with
- "--abbrev=40". But for consistency with other parts of Git,
- we should support "--no-abbrev".
- Worse, blame already accepts --no-abbrev, but it's totally
- broken. When we see --no-abbrev, the abbrev variable is set
- to 0, which is then used as a printf precision. For regular
- sha1s, that means we print nothing at all (which is very
- wrong). For boundary commits we decrement it to "-1", which
- printf interprets as "no limit" (which is almost correct,
- except it misses the 39-length magic explained in the
- previous commit).
- Let's detect --no-abbrev and behave as if --abbrev=40 was
- given.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- blame: fix alignment with --abbrev=40
- The blame command internally adds 1 to any requested sha1
- abbreviation length, and then subtracts it when outputting a
- boundary commit. This lets regular and boundary sha1s line
- up visually, but it misses one corner case.
- When the requested length is 40, we bump the value to 41.
- But since we only have 40 characters, that's all we can show
- (fortunately the truncation is done by a printf precision
- field, so it never tries to read past the end of the
- buffer). So a normal sha1 shows 40 hex characters, and a
- boundary sha1 shows "^" plus 40 hex characters. The result
- is misaligned.
- The "-l" option to show long sha1s gets around this by
- skipping the "abbrev" variable entirely and just always
- using GIT_SHA1_HEXSZ. This avoids the "+1" issue, but it
- does mean that boundary commits only have 39 characters
- printed. This is somewhat odd, but it does look good
- visually: the results are aligned and left-justified. The
- alternative would be to allocate an extra column that would
- contain either an extra space or the "^" boundary marker.
- As this is by definition the human-readable view, it's
- probably not that big a deal either way (and of course
- --porcelain, etc, correctly produce correct 40-hex sha1s).
- But for consistency, this patch teaches --abbrev=40 to
- produce the same output as "-l" (always left-aligned, with
- 40-hex for normal sha1s, and "^" plus 39-hex for
- boundaries).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- files_transaction_commit(): clean up empty directories
- When deleting/pruning references, remove any directories that are made
- empty by the deletion of loose references or of reflogs. Otherwise such
- empty directories can survive forever and accumulate over time. (Even
- 'pack-refs', which is smart enough to remove the parent directories of
- loose references that it prunes, leaves directories that were already
- empty.)
- And now that files_transaction_commit() takes care of deleting the
- parent directories of loose references that it prunes, we don't have to
- do that in prune_ref() anymore.
- This change would be unwise if the *creation* of these directories could
- race with our deletion of them. But the earlier changes in this patch
- series made the creation paths robust against races, so now it is safe
- to tidy them up more aggressively.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- try_remove_empty_parents(): teach to remove parents of reflogs, too
- Add a new "flags" parameter that tells the function whether to remove
- empty parent directories of the loose reference file, of the reflog
- file, or both. The new functionality is not yet used.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- try_remove_empty_parents(): don't trash argument contents
- It's bad manners and surprising and therefore error-prone.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- try_remove_empty_parents(): rename parameter "name" -> "refname"
- This is the standard nomenclature.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- delete_ref_loose(): inline function
- It was hardly doing anything anymore, and had only one caller.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- delete_ref_loose(): derive loose reference path from lock
- It is simpler to derive the path to the file that must be deleted from
- "lock->ref_name" than from the lock_file object.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- log_ref_write_1(): inline function
- Now files_log_ref_write() doesn't do anything beyond call
- log_ref_write_1(), so inline the latter into the former.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- log_ref_setup(): manage the name of the reflog file internally
- Instead of writing the name of the reflog file into a strbuf that is
- supplied by the caller but not needed there, write it into a local
- temporary buffer and remove the strbuf parameter entirely.
- And while we're adjusting the function signature, reorder the arguments
- to move the input parameters before the output parameters.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- log_ref_write_1(): don't depend on logfile argument
- It's unnecessary to pass a strbuf holding the reflog path up and down
- the call stack now that it is hardly needed by the callers. Remove the
- places where log_ref_write_1() uses it, in preparation for making it
- internal to log_ref_setup().
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- log_ref_setup(): pass the open file descriptor back to the caller
- This function will most often be called by log_ref_write_1(), which
- wants to append to the reflog file. In that case, it is silly to close
- the file only for the caller to reopen it immediately. So, in the case
- that the file was opened, pass the open file descriptor back to the
- caller.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- log_ref_setup(): improve robustness against races
- Change log_ref_setup() to use raceproof_create_file() to create the new
- logfile. This makes it more robust against a race against another
- process that might be trying to clean up empty directories while we are
- trying to create a new logfile.
- This also means that it will only call create_leading_directories() if
- open() fails, which should be a net win. Even in the cases where we are
- willing to create a new logfile, it will usually be the case that the
- logfile already exists, or if not then that the directory containing the
- logfile already exists. In such cases, we will save some work that was
- previously done unconditionally.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- log_ref_setup(): separate code for create vs non-create
- The behavior of this function (especially how it handles errors) is
- quite different depending on whether we are willing to create the reflog
- vs. whether we are only trying to open an existing reflog. So separate
- the code paths.
- This also simplifies the next steps.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- log_ref_write(): inline function
- This function doesn't do anything beyond call files_log_ref_write(), so
- replace it with the latter at its call sites.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rename_tmp_log(): improve error reporting
- * Don't capitalize error strings
- * Report true paths of affected files
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rename_tmp_log(): use raceproof_create_file()
- Besides shortening the code, this saves an unnecessary call to
- safe_create_leading_directories_const() in almost all cases.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- lock_ref_sha1_basic(): use raceproof_create_file()
- Instead of coding the retry loop inline, use raceproof_create_file() to
- make lock acquisition safe against directory creation/deletion races.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- lock_ref_sha1_basic(): inline constant
- `lflags` is set a single time then never changed, so just inline it.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- raceproof_create_file(): new function
- Add a function that tries to create a file and any containing
- directories in a way that is robust against races with other processes
- that might be cleaning up empty directories at the same time.
- The actual file creation is done by a callback function, which, if it
- fails, should set errno to EISDIR or ENOENT according to the convention
- of open(). raceproof_create_file() detects such failures, and
- respectively either tries to delete empty directories that might be in
- the way of the file or tries to create the containing directories. Then
- it retries the callback function.
- This function is not yet used.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- safe_create_leading_directories(): set errno on SCLD_EXISTS
- The exit path for SCLD_EXISTS wasn't setting errno, which some callers
- use to generate error messages for the user. Fix the problem and
- document that the function sets errno correctly to help avoid similar
- regressions in the future.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- safe_create_leading_directories_const(): preserve errno
- Some implementations of free() change errno (even thought they
- shouldn't):
- https://sourceware.org/bugzilla/show_bug.cgi?id=17924
- So preserve the errno from safe_create_leading_directories() across the
- call to free().
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t5505: use "for-each-ref" to test for the non-existence of references
- Instead of looking on the filesystem inside ".git/refs/remotes/origin",
- use "git for-each-ref" to check for leftover references under the
- remote's old name.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- refname_is_safe(): correct docstring
- The behavior of refname_is_safe() was changed in
- e40f355 "refname_is_safe(): insist that the refname already be normalized", 2016-04-27
- without a corresponding update to its docstring. The function is in fact
- stricter than documented, because it now insists that the result of
- normalizing the part of a refname following "refs/" is identical to that
- part of the original refname. Fix the docstring.
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- files_rename_ref(): tidy up whitespace
- Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rebase--interactive: count squash commits above 10 correctly
- We generate the squash commit message incrementally running
- a sed script once for each commit. It parses "This is
- a combination of <N> commits" from the first line of the
- existing message, adds one to <N>, and uses the result as
- the number of our current message.
- Since f2d17068fd (i18n: rebase-interactive: mark comments of
- squash for translation, 2016-06-17), the first line may be
- localized, and sed uses a pretty liberal regex, looking for:
- /^#.*([0-9][0-9]*)/
- The "[0-9][0-9]*" tries to match double digits, but it
- doesn't quite work. The first ".*" is greedy, so if you
- have:
- This is a combination of 10 commits.
- it will eat up "This is a combination of 1", leaving "0" to
- match the first "[0-9]" digit, and then skipping the
- optional match of "[0-9]*".
- As a result, the count resets every 10 commits, and a
- 15-commit squash would end up as:
- # This is a combination of 5 commits.
- # This is the 1st commit message:
- ...
- # This is the commit message #2:
- ... and so on ..
- # This is the commit message #10:
- ...
- # This is the commit message #1:
- ...
- # This is the commit message #2:
- ... etc, up to 5 ...
- We can fix this by making the ".*" less greedy. Instead of
- depending on ".*?" working portably, we can just limit the
- match to non-digit characters, which accomplishes the same
- thing.
- Reported-by: Brandon Tolsch <btolsch@gmail.com>
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- branch_get_push: do not segfault when HEAD is detached
- Move the detached HEAD check from branch_get_push_1() to
- branch_get_push() to avoid setting branch->push_tracking_ref when
- branch is NULL.
- Signed-off-by: Kyle Meyer <kyle@kyleam.com>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- archive-zip: load userdiff config
- Since 4aff646d17 (archive-zip: mark text files in archives,
- 2015-03-05), the zip archiver will look at the userdiff
- driver to decide whether a file is text or binary. This
- usually doesn't need to look any further than the attributes
- themselves (e.g., "-diff", etc). But if the user defines a
- custom driver like "diff=foo", we need to look at
- "diff.foo.binary" in the config. Prior to this patch, we
- didn't actually load it.
- Signed-off-by: Jeff King <peff@peff.net>
- Acked-by: René Scharfe <l.s.r@web.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- giteveryday: unbreak rendering with AsciiDoctor
- The "giteveryday" document has a callout list that contains a code
- block. This is not a problem for AsciiDoc, but AsciiDoctor sadly was
- explicitly designed *not* to render this correctly [*1*]. The symptom is
- an unhelpful
- line 322: callout list item index: expected 1 got 12
- line 325: no callouts refer to list item 1
- line 325: callout list item index: expected 2 got 13
- line 327: no callouts refer to list item 2
- In Git for Windows, we rely on the speed improvement of AsciiDoctor (on
- this developer's machine, `make -j15 html` takes roughly 30 seconds with
- AsciiDoctor, 70 seconds with AsciiDoc), therefore we need a way to
- render this correctly.
- The easiest way out is to simplify the callout list, as suggested by
- AsciiDoctor's author, even while one may very well disagree with him
- that a code block hath no place in a callout list.
- *1*: https://github.com/asciidoctor/asciidoctor/issues/1478
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mingw: add a regression test for pushing to UNC paths
- On Windows, there are "UNC paths" to access network (AKA shared)
- folders, of the form \\server\sharename\directory. This provides a
- convenient way for Windows developers to share their Git repositories
- without having to have a dedicated server.
- Git for Windows v2.11.0 introduced a regression where pushing to said
- UNC paths no longer works, although fetching and cloning still does, as
- reported here: https://github.com/git-for-windows/git/issues/979
- This regression was fixed in 7814fbe3f1 (normalize_path_copy(): fix
- pushing to //server/share/dir on Windows, 2016-12-14).
- Let's make sure that it does not regress again, by introducing a test
- that uses so-called "administrative shares": disk volumes are
- automatically shared under certain circumstances, e.g. the C: drive is
- shared as \\localhost\c$. The test needs to be skipped if the current
- directory is inaccessible via said administrative share, of course.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- contrib: remove gitview
- gitview did not have meaningful contributions since 2007, which gives the
- impression it is either a mature or dead project.
- In both cases we should not carry it in git.git as the README for contrib
- states we only want to carry experimental things to give early exposure.
- Recently a security vulnerability was reported by Javantea, so the decision
- to either fix the issue or remove the code in question becomes a bit
- more urgent.
- Reported-by: Javantea <jvoss@altsci.com>
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Acked-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- don't use test_must_fail with grep
- 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>
- submodule.c: use GIT_DIR_ENVIRONMENT consistently
- In C code we have the luxury of having constants for all the important
- things that are hard coded. This is the only place in C that hard codes
- the git directory environment variable, so fix it.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- l10n: fixes to Catalan translation
- Signed-off-by: Jordi Mas <jmas@softcatala.org>
- l10n: zh_CN: review for git v2.11.0 l10n
- Signed-off-by: Ray Chen <oldsharp@gmail.com>
- Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
- Merge branch 'master' of https://github.com/Softcatala/git-po
- * 'master' of https://github.com/Softcatala/git-po:
- l10n: New Catalan translation maintainer
- gitk: ru.po: Update Russian translation
- Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- git-p4: do not pass '-r 0' to p4 commands
- git-p4 crashes when used with a very old p4 client version
- that does not support the '-r <number>' option in its commands.
- Allow making git-p4 work with old p4 clients by setting git-p4.retries to 0.
- Alternatively git-p4.retries could be made opt-in.
- But since only very old, barely maintained p4 versions don't support
- the '-r' option, the setting-retries-to-0 workaround would do.
- The "-r retries" option is present in Perforce 2012.2 Command Reference,
- but absent from Perforce 2012.1 Command Reference.
- Signed-off-by: Igor Kushnir <igorkuo@gmail.com>
- Acked-by: Lars Schneider <larsxschneider@gmail.com>
- Reviewed-by: Luke Diamand <luke@diamand.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- repack: die on incremental + write-bitmap-index
- The bitmap index only works for single packs, so requesting an
- incremental repack with bitmap indexes makes no sense.
- Signed-off-by: David Turner <dturner@twosigma.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- auto gc: don't write bitmaps for incremental repacks
- When git gc --auto does an incremental repack of loose objects, we do
- not expect to be able to write a bitmap; it is very likely that
- objects in the new pack will have references to objects outside of the
- pack. So we shouldn't try to write a bitmap, because doing so will
- likely issue a warning.
- This warning was making its way into gc.log. When the gc.log was
- present, future auto gc runs would refuse to run.
- Patch by Jeff King.
- Bug report, test, and commit message by David Turner.
- Signed-off-by: David Turner <dturner@twosigma.com>
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rm: absorb a submodules git dir before deletion
- When deleting a submodule, we need to keep the actual git directory around,
- such that we do not lose local changes in there and at a later checkout
- of the submodule we don't need to clone it again.
- Now that the functionality is available to absorb the git directory of a
- submodule, rewrite the checking in git-rm to not complain, but rather
- relocate the git directories inside the superproject.
- An alternative solution was discussed to have a function
- `depopulate_submodule`. That would couple the check for its git directory
- and possible relocation before the the removal, such that it is less
- likely to miss the check in the future. But the indirection with such
- a function added seemed also complex. The reason for that was that this
- possible move of the git directory was also implemented in
- `ok_to_remove_submodule`, such that this function could truthfully
- answer whether it is ok to remove the submodule.
- The solution proposed here defers all these checks to the caller.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule: rename and add flags to ok_to_remove_submodule
- In different contexts the question "Is it ok to delete a submodule?"
- may be answered differently.
- In 293ab15eea (submodule: teach rm to remove submodules unless they
- contain a git directory, 2012-09-26) a case was made that we can safely
- ignore ignored untracked files for removal as we explicitely ask for the
- removal of the submodule.
- In a later patch we want to remove submodules even when the user doesn't
- explicitly ask for it (e.g. checking out a tree-ish in which the submodule
- doesn't exist). In that case we want to be more careful when it comes
- to deletion of untracked files. As of this patch it is unclear how this
- will be implemented exactly, so we'll offer flags in which the caller
- can specify how the different untracked files ought to be handled.
- As the flags allow the function to not die on an error when spawning
- a child process, we need to find an appropriate return code for the
- case when the child process could not be started. As in that case we
- cannot tell if the submodule is ok to remove, we'd want to return 'false'.
- As only 0 is understood as false, rename the function to invert the
- meaning, i.e. the return code of 0 signals the removal of the submodule
- is fine, and other values can be used to return a more precise answer
- what went wrong.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule: modernize ok_to_remove_submodule to use argv_array
- Instead of constructing the NULL terminated array ourselves, we
- should make use of the argv_array infrastructure.
- While at it, adapt the error messages to reflect the actual invocation.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule.h: add extern keyword to functions
- As the upcoming series will add a lot of functions to the submodule
- header, let's first make the header consistent to the rest of the project
- by adding the extern keyword to functions.
- As per the CodingGuidelines we try to stay below 80 characters per line,
- so adapt all those functions to stay below 80 characters that are already
- using more than one line. Those function using just one line are better
- kept in one line than breaking them up into multiple lines just for the
- goal of staying below the character limit as it makes grepping
- for functions easier if they are one liners.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- worktree: initialize return value for submodule_uses_worktrees
- When the worktrees directory is empty, the `ret` will be returned
- uninitialized. Fix it by initializing the value.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Fourth batch for 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'jc/lock-report-on-error'
- * jc/lock-report-on-error:
- lockfile: move REPORT_ON_ERROR bit elsewhere
- lockfile: move REPORT_ON_ERROR bit elsewhere
- There was LOCK_NO_DEREF defined as 2 = 1<<1 with the same value,
- which was missed due to a huge comment block. Deconflict by moving
- the new one to 4 = 1<<2 for now.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'js/mingw-isatty'
- Update the isatty() emulation for Windows by updating the previous
- hack that depended on internals of (older) MSVC runtime.
- * js/mingw-isatty:
- mingw: replace isatty() hack
- mingw: fix colourization on Cygwin pseudo terminals
- mingw: adjust is_console() to work with stdin
- Merge branch 'ls/p4-lfs'
- Update GitLFS integration with "git p4".
- * ls/p4-lfs:
- git-p4: add diff/merge properties to .gitattributes for GitLFS files
- Merge branch 'va/i18n-even-more'
- * va/i18n-even-more:
- i18n: fix misconversion in shell scripts
- Merge branch 'lt/shortlog-by-committer'
- "git shortlog" learned "--committer" option to group commits by
- committer, instead of author.
- * lt/shortlog-by-committer:
- t4201: make tests work with and without the MINGW prerequiste
- shortlog: test and document --committer option
- shortlog: group by committer information
- Merge branch 'mk/mingw-winansi-ttyname-termination-fix'
- A potential but unlikely buffer overflow in Windows port has been
- fixed.
- * mk/mingw-winansi-ttyname-termination-fix:
- mingw: consider that UNICODE_STRING::Length counts bytes
- Merge branch 'gv/p4-multi-path-commit-fix'
- "git p4" that tracks multile p4 paths imported a single changelist
- that touches files in these multiple paths as one commit, followed
- by many empty commits. This has been fixed.
- * gv/p4-multi-path-commit-fix:
- git-p4: fix multi-path changelist empty commits
- Merge branch 'jk/difftool-in-subdir'
- Even though an fix was attempted in Git 2.9.3 days, but running
- "git difftool --dir-diff" from a subdirectory never worked. This
- has been fixed.
- * jk/difftool-in-subdir:
- difftool: rename variables for consistency
- difftool: chdir as early as possible
- difftool: sanitize $workdir as early as possible
- difftool: fix dir-diff index creation when in a subdirectory
- Merge branch 'ld/p4-compare-dir-vs-symlink'
- "git p4" misbehaved when swapping a directory and a symbolic link.
- * ld/p4-compare-dir-vs-symlink:
- git-p4: avoid crash adding symlinked directory
- Merge branch 'ls/filter-process'
- Doc update.
- * ls/filter-process:
- t0021: fix flaky test
- docs: warn about possible '=' in clean/smudge filter process values
- Merge branch 'bw/transport-protocol-policy'
- Finer-grained control of what protocols are allowed for transports
- during clone/fetch/push have been enabled via a new configuration
- mechanism.
- * bw/transport-protocol-policy:
- http: respect protocol.*.allow=user for http-alternates
- transport: add from_user parameter to is_transport_allowed
- http: create function to get curl allowed protocols
- transport: add protocol policy config option
- http: always warn if libcurl version is too old
- lib-proto-disable: variable name fix
- Merge branch 'cp/merge-continue'
- "git merge --continue" has been added as a synonym to "git commit"
- to conclude a merge that has stopped due to conflicts.
- * cp/merge-continue:
- merge: mark usage error strings for translation
- merge: ensure '--abort' option takes no arguments
- completion: add --continue option for merge
- merge: add '--continue' option as a synonym for 'git commit'
- Merge branch 'va/i18n-perl-scripts'
- Porcelain scripts written in Perl are getting internationalized.
- * va/i18n-perl-scripts:
- i18n: difftool: mark warnings for translation
- i18n: send-email: mark composing message for translation
- i18n: send-email: mark string with interpolation for translation
- i18n: send-email: mark warnings and errors for translation
- i18n: send-email: mark strings for translation
- i18n: add--interactive: mark status words for translation
- i18n: add--interactive: remove %patch_modes entries
- i18n: add--interactive: mark edit_hunk_manually message for translation
- i18n: add--interactive: i18n of help_patch_cmd
- i18n: add--interactive: mark patch prompt for translation
- i18n: add--interactive: mark plural strings
- i18n: clean.c: match string with git-add--interactive.perl
- i18n: add--interactive: mark strings with interpolation for translation
- i18n: add--interactive: mark simple here-documents for translation
- i18n: add--interactive: mark strings for translation
- Git.pm: add subroutines for commenting lines
- Merge branch 'sb/submodule-config-cleanup'
- Minor code clean-up.
- * sb/submodule-config-cleanup:
- submodule-config: clarify parsing of null_sha1 element
- submodule-config: rename commit_sha1 to treeish_name
- submodule config: inline config_from_{name, path}
- Merge branch 'jc/push-default-explicit'
- A lazy "git push" without refspec did not internally use a fully
- specified refspec to perform 'current', 'simple', or 'upstream'
- push, causing unnecessary "ambiguous ref" errors.
- * jc/push-default-explicit:
- push: test pushing ambiguously named branches
- push: do not use potentially ambiguous default refspec
- l10n: New Catalan translation maintainer
- Signed-off-by: Jordi Mas <jmas@softcatala.org>
- diff: retire "compaction" heuristics
- When a patch inserts a block of lines, whose last lines are the
- same as the existing lines that appear before the inserted block,
- "git diff" can choose any place between these existing lines as the
- boundary between the pre-context and the added lines (adjusting the
- end of the inserted block as appropriate) to come up with variants
- of the same patch, and some variants are easier to read than others.
- We have been trying to improve the choice of this boundary, and Git
- 2.11 shipped with an experimental "compaction-heuristic". Since
- then another attempt to improve the logic further resulted in a new
- "indent-heuristic" logic. It is agreed that the latter gives better
- result overall, and the former outlived its usefulness.
- Retire "compaction", and keep "indent" as an experimental feature.
- The latter hopefully will be turned on by default in a future
- release, but that should be done as a separate step.
- Suggested-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git-svn: escape backslashes in refnames
- This brings git-svn refname escaping up-to-date with
- commit a4c2e69936df8dd0b071b85664c6cc6a4870dd84
- ("Disallow '\' in ref names") from May 2009.
- Reported-by: Michael Fladischer <michael@fladi.at>
- Message-ID: <cb8cd9b1-9882-64d2-435d-40d0b2b82d59@fladi.at>
- Signed-off-by: Eric Wong <e@80x24.org>
- config.abbrev: document the new default that auto-scales
- We somehow forgot to update the "default is 7" in the
- documentation. Also give a way to explicitly ask the auto-scaling
- by setting config.abbrev to "auto".
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- config.c: handle lock file in error case in git_config_rename_...
- We could rely on atexit() to clean up everything, but let's be
- explicit when we can. And it's good anyway because the function is
- called the second time in the same process, we're in trouble.
- This function should not affect the successful case because after
- commit_lock_file() is called, rollback_lock_file() becomes no-op,
- as long as it is initialized.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: search history of moved submodules
- If a submodule was renamed at any point since it's inception then if you
- were to try and grep on a commit prior to the submodule being moved, you
- wouldn't be able to find a working directory for the submodule since the
- path in the past is different from the current path.
- This patch teaches grep to find the .git directory for a submodule in
- the parents .git/modules/ directory in the event the path to the
- submodule in the commit that is being searched differs from the state of
- the currently checked out commit. If found, the child process that is
- spawned to grep the submodule will chdir into its gitdir instead of a
- working directory.
- In order to override the explicit setting of submodule child process's
- gitdir environment variable (which was introduced in '10f5c526')
- `GIT_DIR_ENVIORMENT` needs to be pushed onto child process's env_array.
- This allows the searching of history from a submodule's gitdir, rather
- than from a working directory.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: enable recurse-submodules to work on <tree> objects
- Teach grep to recursively search in submodules when provided with a
- <tree> object. This allows grep to search a submodule based on the state
- of the submodule that is present in a commit of the super project.
- When grep is provided with a <tree> object, the name of the object is
- prefixed to all output. In order to provide uniformity of output
- between the parent and child processes the option `--parent-basename`
- has been added so that the child can preface all of it's output with the
- name of the parent's object instead of the name of the commit SHA1 of
- the submodule. This changes output from the command
- `git grep -e. -l --recurse-submodules HEAD` from:
- HEAD:file
- <commit sha1 of submodule>:sub/file
- to:
- HEAD:file
- HEAD:sub/file
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: optionally recurse into submodules
- Allow grep to recognize submodules and recursively search for patterns in
- each submodule. This is done by forking off a process to recursively
- call grep on each submodule. The top level --super-prefix option is
- used to pass a path to the submodule which can in turn be used to
- prepend to output or in pathspec matching logic.
- Recursion only occurs for submodules which have been initialized and
- checked out by the parent project. If a submodule hasn't been
- initialized and checked out it is simply skipped.
- In order to support the existing multi-threading infrastructure in grep,
- output from each child process is captured in a strbuf so that it can be
- later printed to the console in an ordered fashion.
- To limit the number of theads that are created, each child process has
- half the number of threads as its parents (minimum of 1), otherwise we
- potentailly have a fork-bomb.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- grep: add submodules as a grep source type
- Add `GREP_SOURCE_SUBMODULE` as a grep_source type and cases for this new
- type in the various switch statements in grep.c.
- When initializing a grep_source with type `GREP_SOURCE_SUBMODULE` the
- identifier can either be NULL (to indicate that the working tree will be
- used) or a SHA1 (the REV of the submodule to be grep'd). If the
- identifier is a SHA1 then we want to fall through to the
- `GREP_SOURCE_SHA1` case to handle the copying of the SHA1.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodules: load gitmodules file from commit sha1
- teach submodules to load a '.gitmodules' file from a commit sha1. This
- enables the population of the submodule_cache to be based on the state
- of the '.gitmodules' file from a particular commit.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodules: add helper to determine if a submodule is initialized
- Add the `is_submodule_initialized()` helper function to submodules.c.
- `is_submodule_initialized()` performs a check to determine if the
- submodule at the given path has been initialized.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodules: add helper to determine if a submodule is populated
- Add the `is_submodule_populated()` helper function to submodules.c.
- `is_submodule_populated()` performes a check to see if a submodule has
- been checkout out (and has a valid .git directory/file) at the given path.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- real_path: canonicalize directory separators in root parts
- When an absolute path is resolved, resolution begins at the first path
- component after the root part. The root part is just copied verbatim,
- because it must not be inspected for symbolic links. For POSIX paths,
- this is just the initial slash, but on Windows, the root part has the
- forms c:\ or \\server\share. We do want to canonicalize the back-slashes
- in the root part because these parts are compared to the result of
- getcwd(), which does return a fully canonicalized path.
- Factor out a helper that splits off the root part, and have it
- canonicalize the copied part.
- This change was prompted because t1504-ceiling-dirs.sh caught a breakage
- in GIT_CEILING_DIRECTORIES handling on Windows.
- Signed-off-by: Johannes Sixt <j6t@kdbg.org>
- Acked-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mingw: replace isatty() hack
- Git for Windows has carried a patch that depended on internals
- of MSVC runtime, but it does not work correctly with recent MSVC
- runtime. A replacement was written originally for compiling
- with VC++. The patch in this message is a backport of that
- replacement, and it also fixes the previous attempt to make
- isatty() tell that /dev/null is *not* an interactive terminal.
- Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
- Tested-by: Beat Bolli <dev+git@drbeat.li>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mingw: fix colourization on Cygwin pseudo terminals
- Git only colours the output and uses pagination if isatty() returns 1.
- MSYS2 and Cygwin emulate pseudo terminals via named pipes, meaning that
- isatty() returns 0.
- f7f90e0f4f (mingw: make isatty() recognize MSYS2's pseudo terminals
- (/dev/pty*), 2016-04-27) fixed this for MSYS2 terminals, but not for
- Cygwin.
- The named pipes that Cygwin and MSYS2 use are very similar. MSYS2 PTY pipes
- are called 'msys-*-pty*' and Cygwin uses 'cygwin-*-pty*'. This commit
- modifies the existing check to allow both MSYS2 and Cygwin PTY pipes to be
- identified as TTYs.
- Note that pagination is still broken when running Git for Windows from
- within Cygwin, as MSYS2's less.exe is spawned (and does not like to
- interact with Cygwin's PTY).
- This partially fixes https://github.com/git-for-windows/git/issues/267
- Signed-off-by: Alan Davies <alan.n.davies@gmail.com>
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mingw: adjust is_console() to work with stdin
- When determining whether a handle corresponds to a *real* Win32 Console
- (as opposed to, say, a character device such as /dev/null), we use the
- GetConsoleOutputBufferInfo() function as a tell-tale.
- However, that does not work for *input* handles associated with a
- console. Let's just use the GetConsoleMode() function for input handles,
- and since it does not work on output handles fall back to the previous
- method for those.
- This patch prepares for using is_console() instead of my previous
- misguided attempt in cbb3f3c9b1 (mingw: intercept isatty() to handle
- /dev/null as Git expects it, 2016-12-11) that broke everything on
- Windows.
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Third batch for 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'jt/mailinfo-fold-in-body-headers'
- Fix for NDEBUG builds.
- * jt/mailinfo-fold-in-body-headers:
- mailinfo.c: move side-effects outside of assert
- Merge branch 'jk/index-pack-wo-repo-from-stdin'
- "git index-pack --stdin" needs an access to an existing repository,
- but "git index-pack file.pack" to generate an .idx file that
- corresponds to a packfile does not.
- * jk/index-pack-wo-repo-from-stdin:
- index-pack: skip collision check when not in repository
- t: use nongit() function where applicable
- index-pack: complain when --stdin is used outside of a repo
- t5000: extract nongit function to test-lib-functions.sh
- Merge branch 'jk/parseopt-usage-msg-opt'
- The function usage_msg_opt() has been updated to say "fatal:"
- before the custom message programs give, when they want to die
- with a message about wrong command line options followed by the
- standard usage string.
- * jk/parseopt-usage-msg-opt:
- parse-options: print "fatal:" before usage_msg_opt()
- Merge branch 'jk/quote-env-path-list-component'
- A recent update to receive-pack to make it easier to drop garbage
- objects made it clear that GIT_ALTERNATE_OBJECT_DIRECTORIES cannot
- have a pathname with a colon in it (no surprise!), and this in turn
- made it impossible to push into a repository at such a path. This
- has been fixed by introducing a quoting mechanism used when
- appending such a path to the colon-separated list.
- * jk/quote-env-path-list-component:
- t5615-alternate-env: double-quotes in file names do not work on Windows
- t5547-push-quarantine: run the path separator test on Windows, too
- tmp-objdir: quote paths we add to alternates
- alternates: accept double-quoted paths
- Merge branch 'vs/submodule-clone-nested-submodules-alternates'
- "git clone --reference $there --recurse-submodules $super" has been
- taught to guess repositories usable as references for submodules of
- $super that are embedded in $there while making a clone of the
- superproject borrow objects from $there; extend the mechanism to
- also allow submodules of these submodules to borrow repositories
- embedded in these clones of the submodules embedded in the clone of
- the superproject.
- * vs/submodule-clone-nested-submodules-alternates:
- submodule--helper: set alternateLocation for cloned submodules
- Merge branch 'nd/shallow-fixup'
- Code cleanup in shallow boundary computation.
- * nd/shallow-fixup:
- shallow.c: remove useless code
- shallow.c: bit manipulation tweaks
- shallow.c: avoid theoretical pointer wrap-around
- shallow.c: make paint_alloc slightly more robust
- shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools
- shallow.c: rename fields in paint_info to better express their purposes
- Merge branch 'sb/sequencer-abort-safety'
- Unlike "git am --abort", "git cherry-pick --abort" moved HEAD back
- to where cherry-pick started while picking multiple changes, when
- the cherry-pick stopped to ask for help from the user, and the user
- did "git reset --hard" to a different commit in order to re-attempt
- the operation.
- * sb/sequencer-abort-safety:
- Revert "sequencer: remove useless get_dir() function"
- sequencer: remove useless get_dir() function
- sequencer: make sequencer abort safer
- t3510: test that cherry-pick --abort does not unsafely change HEAD
- am: change safe_to_abort()'s not rewinding error into a warning
- am: fix filename in safe_to_abort() error message
- t5615-alternate-env: double-quotes in file names do not work on Windows
- Protect a recently added test case with !MINGW.
- Signed-off-by: Johannes Sixt <j6t@kdbg.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- fast-import: properly fanout notes when tree is imported
- In typical uses of fast-import, trees are inherited from a parent
- commit. In that case, the tree_entry for the branch looks like:
- .versions[1].sha1 = $some_sha1
- .tree = <tree structure loaded from $some_sha1>
- However, when trees are imported, rather than inherited, that is not the
- case. One can import a tree with a filemodify command, replacing the
- root tree object.
- e.g.
- "M 040000 $some_sha1 \n"
- In this case, the tree_entry for the branch looks like:
- .versions[1].sha1 = $some_sha1
- .tree = NULL
- When adding new notes with the notemodify command, do_change_note_fanout
- is called to get a notes count, and to do so, it loops over the
- tree_entry->tree, but doesn't do anything when the tree is NULL.
- In the latter case above, it means do_change_note_fanout thinks the tree
- contains no notes, and new notes are added with no fanout.
- Interestingly, do_change_note_fanout does check whether subdirectories
- have a NULL .tree, in which case it uses load_tree(). Which means the
- right behaviour happens when using the filemodify command to import
- subdirectories.
- This change makes do_change_note_fanount call load_tree() whenever the
- tree_entry it is given has no tree loaded, making all cases handled
- equally.
- Signed-off-by: Mike Hommey <mh@glandium.org>
- Reviewed-by: Johan Herland <johan@herland.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t4201: make tests work with and without the MINGW prerequiste
- Make sure the tests do not depend on the result of the previous
- tests. With MINGW prerequisite satisfied, a "reset to original and
- rebuild" in an earlier test was skipped, resulting in different
- history being tested with this and the next tests.
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- push: add option to push only submodules
- Teach push the --recurse-submodules=only option. This enables push
- to recursively push all unpushed submodules while leaving the
- superproject unpushed.
- This is a desirable feature in a scenario where updates to the
- superproject are handled automatically by some other means, perhaps
- a tool like Gerrit code review. In this scenario, a developer could
- make a change which spans multiple submodules and then push their
- commits for code review. Upon completion of the code review, their
- commits can be accepted and applied to their respective submodules
- while the code review tool can then automatically update the
- superproject to the most recent SHA1 of each submodule. This would
- reduce the merge conflicts in the superproject that could occur if
- multiple people are contributing to the same submodule.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodules: add RECURSE_SUBMODULES_ONLY value
- Add the `RECURSE_SUBMODULES_ONLY` enum value to submodule.h. This enum
- value will be used in a later patch to push to indicate that only
- submodules should be pushed, while the superproject should remain
- unpushed.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- transport: reformat flag #defines to be more readable
- All of the #defines for the TRANSPORT_* flags are hardcoded to be
- powers of two. This can be error prone when adding a new flag and
- is difficult to read. Update these defines to instead use a shift
- operation to generate the flags and reformat them.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- config.c: rename label unlock_and_out
- There are two ways to unlock a file: commit, or revert. Rename it to
- commit_and_out to avoid confusion.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- config.c: handle error case for fstat() calls
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git-p4: add diff/merge properties to .gitattributes for GitLFS files
- The `git lfs track` command generates a .gitattributes file with diff
- and merge properties [1]. Set the same .gitattributes format for files
- tracked with GitLFS in git-p4.
- [1] https://github.com/git-lfs/git-lfs/blob/v1.5.3/commands/command_track.go#L121
- Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
- Reviewed-by: Luke Diamand <luke@diamand.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: fix misconversion in shell scripts
- An earlier series that was merged at 2703572b3a ("Merge branch
- 'va/i18n-even-more'", 2016-07-13) failed to use $(eval_gettext
- "string with \$variable interpolation") and instead used gettext in
- a few places, and ended up showing the variable names in the
- message, e.g.
- $ git submodule
- fatal: $program_name cannot be used without a working tree.
- Catch these mistakes with
- $ git grep -n '[^_]gettext .*\\\$'
- and fix them all to use eval_gettext instead.
- Reported-by: Josh Bleecher Snyder
- Acked-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mailinfo.c: move side-effects outside of assert
- Since 6b4b013f18 (mailinfo: handle in-body header continuations,
- 2016-09-20, v2.11.0) mailinfo.c has contained new code with an
- assert of the form:
- assert(call_a_function(...))
- The function in question, check_header, has side effects. This
- means that when NDEBUG is defined during a release build the
- function call is omitted entirely, the side effects do not
- take place and tests (fortunately) start failing.
- Since the only time that mi->inbody_header_accum is appended to is
- in check_inbody_header, and appending onto a blank
- mi->inbody_header_accum always happens when is_inbody_header is
- true, this guarantees a prefix that causes check_header to always
- return true.
- Therefore replace the assert with an if !check_header + DIE
- combination to reflect this.
- Helped-by: Jonathan Tan <jonathantanmy@google.com>
- Helped-by: Jeff King <peff@peff.net>
- Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
- Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mingw: consider that UNICODE_STRING::Length counts bytes
- UNICODE_STRING::Length field means size of buffer in bytes[1],
- despite of buffer itself being array of wchar_t. Because of that
- terminating zero is placed twice as far. Fix it.
- [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa380518.aspx
- Signed-off-by: Max Kirillov <max@max630.net>
- Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Second batch for 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'kh/tutorial-grammofix'
- * kh/tutorial-grammofix:
- doc: omit needless "for"
- doc: make the intent of sentence clearer
- doc: add verb in front of command to run
- doc: add articles (grammar)
- Merge branch 'da/mergetool-xxdiff-hotkey'
- The way to specify hotkeys to "xxdiff" that is used by "git
- mergetool" has been modernized to match recent versions of xxdiff.
- * da/mergetool-xxdiff-hotkey:
- mergetools: fix xxdiff hotkeys
- Merge branch 'lr/doc-fix-cet'
- * lr/doc-fix-cet:
- date-formats.txt: Typo fix
- Merge branch 'sb/t3600-cleanup'
- Code cleanup.
- * sb/t3600-cleanup:
- t3600: slightly modernize style
- t3600: remove useless redirect
- Merge branch 'jc/pull-rebase-ff'
- "git pull --rebase", when there is no new commits on our side since
- we forked from the upstream, should be able to fast-forward without
- invoking "git rebase", but it didn't.
- * jc/pull-rebase-ff:
- pull: fast-forward "pull --rebase=true"
- Merge branch 'ld/p4-worktree'
- "git p4" didn't interact with the internal of .git directory
- correctly in the modern "git-worktree"-enabled world.
- * ld/p4-worktree:
- git-p4: support git worktrees
- Merge branch 'jk/make-tags-find-sources-tweak'
- Update the procedure to generate "tags" for developer support.
- * jk/make-tags-find-sources-tweak:
- Makefile: exclude contrib from FIND_SOURCE_FILES
- Makefile: match shell scripts in FIND_SOURCE_FILES
- Makefile: exclude test cruft from FIND_SOURCE_FILES
- Makefile: reformat FIND_SOURCE_FILES
- Merge branch 'js/normalize-path-copy-ceil'
- A pathname that begins with "//" or "\\" on Windows is special but
- path normalization logic was unaware of it.
- * js/normalize-path-copy-ceil:
- normalize_path_copy(): fix pushing to //server/share/dir on Windows
- Merge branch 'bb/unicode-9.0'
- The character width table has been updated to match Unicode 9.0
- * bb/unicode-9.0:
- unicode_width.h: update the width tables to Unicode 9.0
- update_unicode.sh: remove the plane filter
- update_unicode.sh: automatically download newer definition files
- update_unicode.sh: pin the uniset repo to a known good commit
- update_unicode.sh: remove an unnecessary subshell level
- update_unicode.sh: move it into contrib/update-unicode
- Merge branch 'jk/readme-gmane-is-no-more'
- * jk/readme-gmane-is-no-more:
- README: replace gmane link with public-inbox
- Merge branch 'jc/lock-report-on-error'
- Git 2.11 had a minor regression in "merge --ff-only" that competed
- with another process that simultanously attempted to update the
- index. We used to explain what went wrong with an error message,
- but the new code silently failed. The error message has been
- resurrected.
- * jc/lock-report-on-error:
- lockfile: LOCK_REPORT_ON_ERROR
- hold_locked_index(): align error handling with hold_lockfile_for_update()
- wt-status: implement opportunisitc index update correctly
- Merge branch 'jk/xdiff-drop-xdl-fast-hash'
- Retire the "fast hash" that had disastrous performance issues in
- some corner cases.
- * jk/xdiff-drop-xdl-fast-hash:
- xdiff: drop XDL_FAST_HASH
- Merge branch 'nd/rebase-forget'
- "git rebase" learned "--quit" option, which allows a user to
- remove the metadata left by an earlier "git rebase" that was
- manually aborted without using "git rebase --abort".
- * nd/rebase-forget:
- rebase: add --quit to cleanup rebase, leave everything else untouched
- Merge branch 'jk/trailers-placeholder-in-pretty'
- In addition to %(subject), %(body), "log --pretty=format:..."
- learned a new placeholder %(trailers).
- * jk/trailers-placeholder-in-pretty:
- ref-filter: add support to display trailers as part of contents
- pretty: add %(trailers) format for displaying trailers of a commit message
- Merge branch 'ak/commit-only-allow-empty'
- "git commit --allow-empty --only" (no pathspec) with dirty index
- ought to be an acceptable way to create a new commit that does not
- change any paths, but it was forbidden, perhaps because nobody
- needed it so far.
- * ak/commit-only-allow-empty:
- commit: remove 'Clever' message for --only --amend
- commit: make --only --allow-empty work without paths
- Merge branch 'da/difftool-dir-diff-fix'
- "git difftool --dir-diff" had a minor regression when started from
- a subdirectory, which has been fixed.
- * da/difftool-dir-diff-fix:
- difftool: fix dir-diff index creation when in a subdirectory
- Merge branch 'jb/diff-no-index-no-abbrev'
- "git diff --no-index" did not take "--no-abbrev" option.
- * jb/diff-no-index-no-abbrev:
- diff: handle --no-abbrev in no-index case
- Merge branch 'rj/git-version-gen-do-not-force-abbrev'
- A minor build update.
- * rj/git-version-gen-do-not-force-abbrev:
- GIT-VERSION-GEN: do not force abbreviation length used by 'describe'
- Merge branch 'jk/stash-disable-renames-internally'
- When diff.renames configuration is on (and with Git 2.9 and later,
- it is enabled by default, which made it worse), "git stash"
- misbehaved if a file is removed and another file with a very
- similar content is added.
- * jk/stash-disable-renames-internally:
- stash: prefer plumbing over git-diff
- Merge branch 'jk/http-walker-limit-redirect'
- Update the error messages from the dumb-http client when it fails
- to obtain loose objects; we used to give sensible error message
- only upon 404 but we now forbid unexpected redirects that needs to
- be reported with something sensible.
- * jk/http-walker-limit-redirect:
- http-walker: complain about non-404 loose object errors
- Merge branch 'jk/http-walker-limit-redirect-2.9'
- Transport with dumb http can be fooled into following foreign URLs
- that the end user does not intend to, especially with the server
- side redirects and http-alternates mechanism, which can lead to
- security issues. Tighten the redirection and make it more obvious
- to the end user when it happens.
- * jk/http-walker-limit-redirect-2.9:
- http: treat http-alternates like redirects
- http: make redirects more obvious
- remote-curl: rename shadowed options variable
- http: always update the base URL for redirects
- http: simplify update_url_from_redirect
- Merge branch 'nd/for-each-ref-ignore-case'
- "git branch --list" and friends learned "--ignore-case" option to
- optionally sort branches and tags case insensitively.
- * nd/for-each-ref-ignore-case:
- tag, branch, for-each-ref: add --ignore-case for sorting and filtering
- Merge branch 'sb/unpack-trees-grammofix'
- * sb/unpack-trees-grammofix:
- unpack-trees: fix grammar for untracked files in directories
- Merge branch 'ls/travis-update-p4-and-lfs'
- The default Travis-CI configuration specifies newer P4 and GitLFS.
- * ls/travis-update-p4-and-lfs:
- travis-ci: update P4 to 16.2 and GitLFS to 1.5.2 in Linux build
- Merge branch 'ls/t0021-fixup'
- * ls/t0021-fixup:
- t0021: minor filter process test cleanup
- Merge branch 'ah/grammos'
- A few messages have been fixed for their grammatical errors.
- * ah/grammos:
- clone,fetch: explain the shallow-clone option a little more clearly
- receive-pack: improve English grammar of denyCurrentBranch message
- bisect: improve English grammar of not-ancestors message
- Merge branch 'jc/renormalize-merge-kill-safer-crlf'
- Fix a corner case in merge-recursive regression that crept in
- during 2.10 development cycle.
- * jc/renormalize-merge-kill-safer-crlf:
- convert: git cherry-pick -Xrenormalize did not work
- merge-recursive: handle NULL in add_cacheinfo() correctly
- cherry-pick: demonstrate a segmentation fault
- Merge branch 'jt/use-trailer-api-in-commands'
- Commands that operate on a log message and add lines to the trailer
- blocks, such as "format-patch -s", "cherry-pick (-x|-s)", and
- "commit -s", have been taught to use the logic of and share the
- code with "git interpret-trailer".
- * jt/use-trailer-api-in-commands:
- sequencer: use trailer's trailer layout
- trailer: have function to describe trailer layout
- trailer: avoid unnecessary splitting on lines
- commit: make ignore_non_trailer take buf/len
- trailer: be stricter in parsing separators
- git-p4: fix multi-path changelist empty commits
- When importing from multiple perforce paths - we may attempt to
- import a changelist that contains files from two (or more) of these
- depot paths. Currently, this results in multiple git commits - one
- containing the changes, and the other(s) as empty commit(s). This
- behavior was introduced in commit 1f90a64891 ("git-p4: reduce number
- of server queries for fetches", 2015-12-19).
- Reproduction Steps:
- 1. Have a git repo cloned from a perforce repo using multiple
- depot paths (e.g. //depot/foo and //depot/bar).
- 2. Submit a single change to the perforce repo that makes changes
- in both //depot/foo and //depot/bar.
- 3. Run "git p4 sync" to sync the change from #2.
- Change is synced as multiple commits, one for each depot path that
- was affected.
- Using a set, instead of a list inside p4ChangesForPaths() ensures
- that each changelist is unique to the returned list, and therefore
- only a single commit is generated for each changelist.
- Reported-by: James Farwell <jfarwell@vmware.com>
- Signed-off-by: George Vanburgh <gvanburgh@bloomberg.net>
- Reviewed-by: Luke Diamand <luke@diamand.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git-p4: avoid crash adding symlinked directory
- When submitting to P4, if git-p4 came across a symlinked
- directory, then during the generation of the submit diff, it would
- try to open it as a normal file and fail.
- Spot symlinks (of any type) and output a description of the symlink
- instead.
- Add a test case.
- Signed-off-by: Luke Diamand <luke@diamand.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t0021: fix flaky test
- t0021.15 creates files, adds them to the index, and commits them. All
- this usually happens in a test run within the same second and Git cannot
- know if the files have been changed between `add` and `commit`. Thus,
- Git has to run the clean filter in both operations. Sometimes these
- invocations spread over two different seconds and Git can infer that the
- files were not changed between `add` and `commit` based on their
- modification timestamp. The test would fail as it expects the filter
- invocation. Remove this expectation to make the test stable.
- Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- First batch for 2.12
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'ls/p4-retry-thrice'
- * ls/p4-retry-thrice:
- git-p4: add config to retry p4 commands; retry 3 times by default
- Merge branch 'ls/p4-empty-file-on-lfs'
- "git p4" LFS support was broken when LFS stores an empty blob.
- * ls/p4-empty-file-on-lfs:
- git-p4: fix empty file processing for large file system backend GitLFS
- Merge branch 'ld/p4-update-shelve'
- * ld/p4-update-shelve:
- git-p4: support updating an existing shelved changelist
- Merge branch 'vk/p4-submit-shelve'
- * vk/p4-submit-shelve:
- git-p4: allow submit to create shelved changelists.
- Merge branch 'da/mergetool-trust-exit-code'
- mergetool.<tool>.trustExitCode configuration variable did not apply
- to built-in tools, but now it does.
- * da/mergetool-trust-exit-code:
- mergetools/vimdiff: trust Vim's exit code
- mergetool: honor mergetool.$tool.trustExitCode for built-in tools
- Merge branch 'ak/lazy-prereq-mktemp'
- Test code clean-up.
- * ak/lazy-prereq-mktemp:
- t7610: clean up foo.XXXXXX tmpdir
- Merge branch 'nd/worktree-list-fixup'
- The output from "git worktree list" was made in readdir() order,
- and was unstable.
- * nd/worktree-list-fixup:
- worktree list: keep the list sorted
- worktree.c: get_worktrees() takes a new flag argument
- get_worktrees() must return main worktree as first item even on error
- worktree: reorder an if statement
- worktree.c: zero new 'struct worktree' on allocation
- Merge branch 'nd/qsort-in-merge-recursive'
- Code simplification.
- * nd/qsort-in-merge-recursive:
- merge-recursive.c: use string_list_sort instead of qsort
- Merge branch 'bw/push-dry-run'
- "git push --dry-run --recurse-submodule=on-demand" wasn't
- "--dry-run" in the submodules.
- * bw/push-dry-run:
- push: fix --dry-run to not push submodules
- push: --dry-run updates submodules when --recurse-submodules=on-demand
- Merge branch 'hv/submodule-not-yet-pushed-fix'
- The code in "git push" to compute if any commit being pushed in the
- superproject binds a commit in a submodule that hasn't been pushed
- out was overly inefficient, making it unusable even for a small
- project that does not have any submodule but have a reasonable
- number of refs.
- * hv/submodule-not-yet-pushed-fix:
- submodule_needs_pushing(): explain the behaviour when we cannot answer
- batch check whether submodule needs pushing into one call
- serialize collection of refs that contain submodule changes
- serialize collection of changed submodules
- Merge branch 'dt/empty-submodule-in-merge'
- An empty directory in a working tree that can simply be nuked used
- to interfere while merging or cherry-picking a change to create a
- submodule directory there, which has been fixed..
- * dt/empty-submodule-in-merge:
- submodules: allow empty working-tree dirs in merge/cherry-pick
- Merge branch 'jk/rev-parse-symbolic-parents-fix'
- "git rev-parse --symbolic" failed with a more recent notation like
- "HEAD^-1" and "HEAD^!".
- * jk/rev-parse-symbolic-parents-fix:
- rev-parse: fix parent shorthands with --symbolic
- index-pack: skip collision check when not in repository
- You can run "git index-pack path/to/foo.pack" outside of a
- repository to generate an index file, or just to verify the
- contents. There's no point in doing a collision check, since
- we obviously do not have any objects to collide with.
- The current code will blindly look in .git/objects based on
- the result of setup_git_env(). That effectively gives us the
- right answer (since we won't find any objects), but it's a
- waste of time, and it conflicts with our desire to
- eventually get rid of the "fallback to .git" behavior of
- setup_git_env().
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- normalize_path_copy(): fix pushing to //server/share/dir on Windows
- normalize_path_copy() is not prepared to keep the double-slash of a
- //server/share/dir kind of path, but treats it like a regular POSIX
- style path and transforms it to /server/share/dir.
- The bug manifests when 'git push //server/share/dir master' is run,
- because tmp_objdir_add_as_alternate() uses the path in normalized
- form when it registers the quarantine object database via
- link_alt_odb_entries(). Needless to say that the directory cannot be
- accessed using the wrongly normalized path.
- Fix it by skipping all of the root part, not just a potential drive
- prefix. offset_1st_component takes care of this, see the
- implementation in compat/mingw.c::mingw_offset_1st_component().
- Signed-off-by: Johannes Sixt <j6t@kdbg.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- shortlog: test and document --committer option
- This puts the final touches on the feature added by
- fbfda15fb8 (shortlog: group by committer information,
- 2016-10-11).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t: use nongit() function where applicable
- Many tests want to run a command outside of any git repo;
- with the nongit() function this is now a one-liner. It saves
- a few lines, but more importantly, it's immediately obvious
- what the code is trying to accomplish.
- This doesn't convert every such case in the test suite; it
- just covers those that want to do a one-off command. Other
- cases, such as the ones in t4035, are part of a larger
- scheme of outside-repo files, and it's less confusing for
- them to stay consistent with the surrounding tests.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- index-pack: complain when --stdin is used outside of a repo
- The index-pack builtin is marked as RUN_SETUP_GENTLY,
- because it's perfectly fine to index a pack in the
- filesystem outside of any repository. However, --stdin mode
- will write the result to the object database, which does not
- make sense outside of a repository. Doing so creates a bogus
- ".git" directory with nothing in it except the newly-created
- pack and its index.
- Instead, let's flag this as an error and abort.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t5000: extract nongit function to test-lib-functions.sh
- This function abstracts the idea of running a command
- outside of any repository (which is slightly awkward to do
- because even if you make a non-repo directory, git may keep
- walking up outside of the trash directory). There are
- several scripts that use the same technique, so let's make
- the function available for everyone.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- shortlog: group by committer information
- In some situations you may want to group the commits not by author,
- but by committer instead.
- For example, when I just wanted to look up what I'm still missing from
- linux-next in the current merge window, I don't care so much about who
- wrote a patch, as what git tree it came from, which generally boils
- down to "who committed it".
- So make git shortlog take a "-c" or "--committer" option to switch
- grouping to that.
- Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- merge: mark usage error strings for translation
- The nearby error messages are already marked for
- translation, but these new ones aren't.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- README: replace gmane link with public-inbox
- The general status and future of gmane is unclear at this
- point, but certainly it does not seem to be carrying
- gmane.comp.version-control.git at all anymore. Let's point
- to public-inbox.org, which seems to be the favored archive
- on the list these days (and which uses message-ids in its
- URLs, making the links somewhat future-proof).
- Reported-by: Chiel ten Brinke <ctenbrinke@gmail.com>
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- http: respect protocol.*.allow=user for http-alternates
- The http-walker may fetch the http-alternates (or
- alternates) file from a remote in order to find more
- objects. This should count as a "not from the user" use of
- the protocol. But because we implement the redirection
- ourselves and feed the new URL to curl, it will use the
- CURLOPT_PROTOCOLS rules, not the more restrictive
- CURLOPT_REDIR_PROTOCOLS.
- The ideal solution would be for each curl request we make to
- know whether or not is directly from the user or part of an
- alternates redirect, and then set CURLOPT_PROTOCOLS as
- appropriate. However, that would require plumbing that
- information through all of the various layers of the http
- code.
- Instead, let's check the protocol at the source: when we are
- parsing the remote http-alternates file. The only downside
- is that if there's any mismatch between what protocol we
- think it is versus what curl thinks it is, it could violate
- the policy.
- To address this, we'll make the parsing err on the picky
- side, and only allow protocols that it can parse
- definitively. So for example, you can't elude the "http"
- policy by asking for "HTTP://", even though curl might
- handle it; we would reject it as unknown. The only unsafe
- case would be if you have a URL that starts with "http://"
- but curl interprets as another protocol. That seems like an
- unlikely failure mode (and we are still protected by our
- base CURLOPT_PROTOCOL setting, so the worst you could do is
- trigger one of https, ftp, or ftps).
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- transport: add from_user parameter to is_transport_allowed
- Add a from_user parameter to is_transport_allowed() to allow http to be
- able to distinguish between protocol restrictions for redirects versus
- initial requests. CURLOPT_REDIR_PROTOCOLS can now be set differently
- from CURLOPT_PROTOCOLS to disallow use of protocols with the "user"
- policy in redirects.
- This change allows callers to query if a transport protocol is allowed,
- given that the caller knows that the protocol is coming from the user
- (1) or not from the user (0) such as redirects in libcurl. If unknown a
- -1 should be provided which falls back to reading
- `GIT_PROTOCOL_FROM_USER` to determine if the protocol came from the
- user.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- http: create function to get curl allowed protocols
- Move the creation of an allowed protocols whitelist to a helper
- function. This will be useful when we need to compute the set of
- allowed protocols differently for normal and redirect cases.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- transport: add protocol policy config option
- Previously the `GIT_ALLOW_PROTOCOL` environment variable was used to
- specify a whitelist of protocols to be used in clone/fetch/push
- commands. This patch introduces new configuration options for more
- fine-grained control for allowing/disallowing protocols. This also has
- the added benefit of allowing easier construction of a protocol
- whitelist on systems where setting an environment variable is
- non-trivial.
- Now users can specify a policy to be used for each type of protocol via
- the 'protocol.<name>.allow' config option. A default policy for all
- unconfigured protocols can be set with the 'protocol.allow' config
- option. If no user configured default is made git will allow known-safe
- protocols (http, https, git, ssh, file), disallow known-dangerous
- protocols (ext), and have a default policy of `user` for all other
- protocols.
- The supported policies are `always`, `never`, and `user`. The `user`
- policy can be used to configure a protocol to be usable when explicitly
- used by a user, while disallowing it for commands which run
- clone/fetch/push commands without direct user intervention (e.g.
- recursive initialization of submodules). Commands which can potentially
- clone/fetch/push from untrusted repositories without user intervention
- can export `GIT_PROTOCOL_FROM_USER` with a value of '0' to prevent
- protocols configured to the `user` policy from being used.
- Fix remote-ext tests to use the new config to allow the ext
- protocol to be tested.
- Based on a patch by Jeff King <peff@peff.net>
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- http: always warn if libcurl version is too old
- Always warn if libcurl version is too old because:
- 1. Even without a protocol whitelist, newer versions of curl have all
- non-standard protocols disabled by default.
- 2. A future patch will introduce default "known-good" and "known-bad"
- protocols which are allowed/disallowed by 'is_transport_allowed'
- which older version of libcurl can't respect.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- lib-proto-disable: variable name fix
- The test_proto function assigns the positional parameters to named
- variables, but then still refers to "$desc" as "$1". Using $desc is
- more readable and less error-prone.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Revert "sequencer: remove useless get_dir() function"
- This reverts commit 39784cd3620cc47415c9010ec58a9616f040125c.
- The function had only one caller when the "remove useless" was
- written, but another topic will soon make heavy use of it and more
- importantly the function will return different paths depending on
- the value in opts.
- i18n: difftool: mark warnings for translation
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: send-email: mark composing message for translation
- When composing an e-mail, there is a message for the user whose lines
- begin in "GIT:" that can be marked for translation.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: send-email: mark string with interpolation for translation
- Mark warnings, errors and other messages that are interpolated for
- translation.
- We call sprintf() before calling die() and in few other circumstances in
- order to replace the values on the placeholders.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: send-email: mark warnings and errors for translation
- Mark warnings, errors and other messages for translation.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: send-email: mark strings for translation
- Mark strings often displayed to the user for translation.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: mark status words for translation
- Mark words 'nothing', 'unchanged' and 'binary' used to display what has
- been staged or not, in "git add -i" status command.
- Alternatively one could mark N__('nothing') no-op in order to
- xgettext(1) extract the string and then trigger the translation at run
- time only with __($print->{FILE}), but that has the side effect of triggering
- retrieval of translations for the changes indicator too (e.g. +2/-1)
- which may or may not be a problem.
- To avoid that potential problem, mark only where there is certain to
- trigger translation only of those words but in this case we must also
- retrieve the translation for the eq tests, since the value assigned was
- of the translation, not the English source.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: remove %patch_modes entries
- Remove unnecessary entries from %patch_modes. After the i18n conversion,
- these entries are not used anymore.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: mark edit_hunk_manually message for translation
- Mark message of edit_hunk_manually displayed in the editing file when
- user chooses 'e' option. The message had to be unfolded to allow
- translation of the $participle verb.
- Some messages end up being exactly the same for some use cases, but
- left it for easier change in the future, e.g., wanting to change wording
- of one particular use case.
- The comment character is now used according to the git configuration
- core.commentchar.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: i18n of help_patch_cmd
- Mark help message of help_patch_cmd for translation. The message must
- be unfolded to be free of variables so we can have high quality
- translations.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: mark patch prompt for translation
- Mark prompt message assembled in place for translation, unfolding each
- use case for each entry in the %patch_modes hash table.
- Previously, this script relied on whether $patch_mode was set to run the
- command patch_update_cmd() or show status and loop the main loop. Now,
- it uses $cmd to indicate we must run patch_update_cmd() and $patch_mode
- is used to tell which flavor of the %patch_modes are we on. This is
- introduced in order to be able to mark and unfold the message prompt
- knowing in which context we are.
- The tracking of context was done previously by point %patch_mode_flavour
- hash table to the correct entry of %patch_modes, focusing only on value
- of %patch_modes. Now, we are also interested in the key ('staged',
- 'stash', 'checkout_head', ...).
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: mark plural strings
- Mark plural strings for translation. Unfold each action case in one
- entire sentence.
- Pass new keyword for xgettext to extract.
- Update test to include new subroutine __n() for plural strings handling.
- Update documentation to include a description of the new __n()
- subroutine.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: clean.c: match string with git-add--interactive.perl
- Change strings for help to match the ones in git-add--interactive.perl.
- The strings now represent one entry to translate each rather then two
- entries each different only by an ending newline character.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: mark strings with interpolation for translation
- Since at this point Git::I18N.perl lacks support for Perl i18n
- placeholder substitution, use of sprintf following die or error_msg is
- necessary for placeholder substitution take place.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: mark simple here-documents for translation
- Mark messages in here-documents without interpolation for translation.
- The here-document delimiter \EOF, which is the same as 'EOF', indicates
- that the text is to be treated literally without interpolation of its
- content. Unfortunately xgettext is not able to extract here-documents
- delimited with \EOF but it is with delimiter enclosed in single quotes.
- So change \EOF to 'EOF', although in this case does not make
- difference what variation of here-document to use since there is nothing
- to interpolate.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- i18n: add--interactive: mark strings for translation
- Mark simple strings (without interpolation) for translation.
- Brackets around first parameter of ternary operator is necessary because
- otherwise xgettext fails to extract strings marked for translation from
- the rest of the file.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Git.pm: add subroutines for commenting lines
- Add subroutines prefix_lines and comment_lines.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- merge: ensure '--abort' option takes no arguments
- Like '--continue', the '--abort' option doesn't make any sense with
- other options or arguments to 'git merge' so ensure that none are
- present.
- Signed-off-by: Chris Packham <judge.packham@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- completion: add --continue option for merge
- Add 'git merge --continue' option when completing.
- Signed-off-by: Chris Packham <judge.packham@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- merge: add '--continue' option as a synonym for 'git commit'
- Teach 'git merge' the --continue option which allows 'continuing' a
- merge by completing it. The traditional way of completing a merge after
- resolving conflicts is to use 'git commit'. Now with commands like 'git
- rebase' and 'git cherry-pick' having a '--continue' option adding such
- an option to 'git merge' presents a consistent UI.
- Signed-off-by: Chris Packham <judge.packham@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- parse-options: print "fatal:" before usage_msg_opt()
- Programs may use usage_msg_opt() to print a brief message
- followed by the program usage, and then exit. The message
- isn't prefixed at all, though, so it doesn't match our usual
- error output and is easy to overlook:
- $ git clone 1 2 3
- Too many arguments.
- usage: git clone [<options>] [--] <repo> [<dir>]
- -v, --verbose be more verbose
- -q, --quiet be more quiet
- --progress force progress reporting
- -n, --no-checkout don't create a checkout
- --bare create a bare repository
- [...and so on for another 31 lines...]
- It looks especially bad when the message starts with an
- option, like:
- $ git replace -e
- -e needs exactly one argument
- usage: git replace [-f] <object> <replacement>
- or: git replace [-f] --edit <object>
- [...etc...]
- Let's put our usual "fatal:" prefix in front of it.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Makefile: exclude contrib from FIND_SOURCE_FILES
- When you're working on the git project, you're unlikely to
- care about random bits in contrib/ (e.g., you would not want
- to jump to the copy of xmalloc in the wincred credential
- helper). Nobody has really complained because there are
- relatively few C files in contrib.
- Now that we're matching shell scripts, too, we get quite a
- few more hits, especially in the obsolete contrib/examples
- directory. Looking for usage() should turn up the one in
- git-sh-setup, not in some long-dead version of git-clone.
- Let's just exclude all of contrib. Any specific projects
- there which are big enough to want tags can generate them
- separately.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Makefile: match shell scripts in FIND_SOURCE_FILES
- We feed FIND_SOURCE_FILES to ctags to help developers
- navigate to particular functions, but we only feed C source
- code. The same feature can be helpful when working with
- shell scripts (especially the test suite). Modern versions
- of ctags know how to parse shell scripts; we just need to
- feed the filenames to it.
- This patch specifically avoids including the individual test
- scripts themselves. Those are unlikely to be of interest,
- and there are a lot of them to process. It does pick up
- test-lib.sh and test-lib-functions.sh.
- Note that our negative pathspec already excludes the
- individual scripts for the ls-files case, but we need to
- loosen the `find` rule to match it.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Makefile: exclude test cruft from FIND_SOURCE_FILES
- The test directory may contain three types of files that
- match our patterns:
- 1. Helper programs in t/helper.
- 2. Sample data files (e.g., t/t4051/hello.c).
- 3. Untracked cruft in trash directories and t/perf/build.
- We want to match (1), but not the other two, as they just
- clutter up the list.
- For the ls-files method, we can drop (2) with a negative
- pathspec. We do not have to care about (3), since ls-files
- will not list untracked files.
- For `find`, we can match both cases with `-prune` patterns.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Makefile: reformat FIND_SOURCE_FILES
- As we add to this in future commits, the formatting is going
- to make it harder and harder to read. Let's write it more as
- we would in a shell script, putting each logical block on
- its own line.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- unicode_width.h: update the width tables to Unicode 9.0
- Rerunning update-unicode.sh that we fixed in the previous commits
- produces these new tables.
- Signed-off-by: Beat Bolli <dev+git@drbeat.li>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- update_unicode.sh: remove the plane filter
- The uniset upstream has accepted my patches that eliminate the Unicode
- plane offsets from the output in '--32' mode.
- Remove the corresponding filter in update_unicode.sh.
- This also fixes the issue that the plane offsets were not removed from
- the second uniset call.
- Signed-off-by: Beat Bolli <dev+git@drbeat.li>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- update_unicode.sh: automatically download newer definition files
- Checking just for the unicode data files' existence is not sufficient;
- we should also download them if a newer version exists on the Unicode
- consortium's servers. Option -N of wget does this nicely for us.
- Reviewed-by: Torsten Bögershausen <tboegi@web.de>
- Signed-off-by: Beat Bolli <dev+git@drbeat.li>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- update_unicode.sh: pin the uniset repo to a known good commit
- The uniset upstream has added more commits that for example change the
- hexadecimal output in '--32' mode to decimal. Let's pin the repo to a
- commit that still outputs the width tables in the format we want.
- Signed-off-by: Beat Bolli <dev+git@drbeat.li>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- update_unicode.sh: remove an unnecessary subshell level
- After the move into contrib/update-unicode, we no longer create the
- unicode directory to have a clean working folder. Instead, the directory
- of the script is used. This means that the subshell can be removed.
- Signed-off-by: Beat Bolli <dev+git@drbeat.li>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- update_unicode.sh: move it into contrib/update-unicode
- As it's used only by a tiny minority of the Git developer population,
- this script does not belong into the main Git source directory.
- Move it into contrib/ and adjust the paths to account for the new
- location.
- Signed-off-by: Beat Bolli <dev+git@drbeat.li>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git-p4: support git worktrees
- git-p4 would attempt to find the git directory using
- its own specific code, which did not know about git
- worktrees.
- Rework it to use "git rev-parse --git-dir" instead.
- Add test cases for worktree usage and specifying
- git directory via --git-dir and $GIT_DIR.
- Signed-off-by: Luke Diamand <luke@diamand.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Early fixes for 2.11.x series
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'ew/svn-fixes'
- * ew/svn-fixes:
- git-svn: document useLogAuthor and addAuthorFrom config keys
- git-svn: allow "0" in SVN path components
- Merge branch 'js/mingw-isatty'
- We often decide if a session is interactive by checking if the
- standard I/O streams are connected to a TTY, but isatty() emulation
- on Windows incorrectly returned true if it is used on NUL (i.e. an
- equivalent to /dev/null). This has been fixed.
- * js/mingw-isatty:
- mingw: intercept isatty() to handle /dev/null as Git expects it
- t5547-push-quarantine: run the path separator test on Windows, too
- To perform the test case on Windows in a way that corresponds to the
- POSIX version, inject the semicolon in a directory name.
- Typically, an absolute POSIX style path, such as the one in $PWD, is
- translated into a Windows style path by bash when it invokes git.exe.
- However, the presence of the semicolon suppresses this translation;
- but the untranslated POSIX style path is useless for git.exe.
- Therefore, instead of $PWD pass the Windows style path that $(pwd)
- produces.
- Signed-off-by: Johannes Sixt <j6t@kdbg.org>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t3600: slightly modernize style
- Remove the space between redirection and file name.
- Also remove unnecessary invocations of subshells, such as
- (cd submod &&
- echo X >untracked
- ) &&
- as there is no point of having the shell for functional purposes.
- In case of a single Git command use the `-C` option to let Git cd into
- the directory.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- real_path: have callers use real_pathdup and strbuf_realpath
- Migrate callers of real_path() who duplicate the retern value to use
- real_pathdup or strbuf_realpath.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- real_path: create real_pathdup
- Create real_pathdup which returns a caller owned string of the resolved
- realpath based on the provide path.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- real_path: convert real_path_internal to strbuf_realpath
- Change the name of real_path_internal to strbuf_realpath. In addition
- push the static strbuf up to its callers and instead take as a
- parameter a pointer to a strbuf to use for the final result.
- This change makes strbuf_realpath reentrant.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- real_path: resolve symlinks by hand
- The current implementation of real_path uses chdir() in order to resolve
- symlinks. Unfortunately this isn't thread-safe as chdir() affects a
- process as a whole and not just an individual thread. Instead perform
- the symlink resolution by hand so that the calls to chdir() can be
- removed, making real_path one step closer to being reentrant.
- Signed-off-by: Brandon Williams <bmwill@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule: add absorb-git-dir function
- When a submodule has its git dir inside the working dir, the submodule
- support for checkout that we plan to add in a later patch will fail.
- Add functionality to migrate the git directory to be absorbed
- into the superprojects git directory.
- The newly added code in this patch is structured such that other areas of
- Git can also make use of it. The code in the submodule--helper is a mere
- wrapper and option parser for the function
- `absorb_git_dir_into_superproject`, that takes care of embedding the
- submodules git directory into the superprojects git dir. That function
- makes use of the more abstract function for this use case
- `relocate_gitdir`, which can be used by e.g. the worktree code eventually
- to move around a git directory.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- move connect_work_tree_and_git_dir to dir.h
- That function was primarily used by submodule code, but the function
- itself is not inherently about submodules. In the next patch we'll
- introduce relocate_git_dir, which can be used by worktrees as well,
- so find a neutral middle ground in dir.h.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- worktree: check if a submodule uses worktrees
- In a later patch we want to move around the the git directory of
- a submodule. Both submodules as well as worktrees are involved in
- placing git directories at unusual places, so their functionality
- may collide. To react appropriately to situations where worktrees
- in submodules are in use, offer a new function to query the
- a submodule if it uses the worktree feature.
- An earlier approach:
- "Implement submodule_get_worktrees and just count them", however:
- This can be done cheaply (both in new code to write as well as run time)
- by obtaining the list of worktrees based off that submodules git
- directory. However as we have loaded the variables for the current
- repository, the values in the submodule worktree
- can be wrong, e.g.
- * core.ignorecase may differ between these two repositories
- * the ref resolution is broken (refs/heads/branch in the submodule
- resolves to the sha1 value of the `branch` in the current repository
- that may not exist or have another sha1)
- The implementation here is just checking for any files in
- $GIT_COMMON_DIR/worktrees for the submodule, which ought to be sufficient
- if the submodule is using the current repository format, which we also
- check.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- tmp-objdir: quote paths we add to alternates
- Commit 722ff7f87 (receive-pack: quarantine objects until
- pre-receive accepts, 2016-10-03) regressed pushes to
- repositories with colon (or semi-colon in Windows in them)
- because it adds the repository's main object directory to
- GIT_ALTERNATE_OBJECT_DIRECTORIES. The receiver interprets
- the colon as a delimiter, not as part of the path, and
- index-pack is unable to find objects which it needs to
- resolve deltas.
- The previous commit introduced a quoting mechanism for the
- alternates list; let's use it here to cover this case. We'll
- avoid quoting when we can, though. This alternate setup is
- also used when calling hooks, so it's possible that the user
- may call older git implementations which don't understand
- the quoting mechanism. By quoting only when necessary, this
- setup will continue to work unless the user _also_ has a
- repository whose path contains the delimiter.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- alternates: accept double-quoted paths
- We read lists of alternates from objects/info/alternates
- files (delimited by newline), as well as from the
- GIT_ALTERNATE_OBJECT_DIRECTORIES environment variable
- (delimited by colon or semi-colon, depending on the
- platform).
- There's no mechanism for quoting the delimiters, so it's
- impossible to specify an alternate path that contains a
- colon in the environment, or one that contains a newline in
- a file. We've lived with that restriction for ages because
- both alternates and filenames with colons are relatively
- rare, and it's only a problem when the two meet. But since
- 722ff7f87 (receive-pack: quarantine objects until
- pre-receive accepts, 2016-10-03), which builds on the
- alternates system, every push causes the receiver to set
- GIT_ALTERNATE_OBJECT_DIRECTORIES internally.
- It would be convenient to have some way to quote the
- delimiter so that we can represent arbitrary paths.
- The simplest thing would be an escape character before a
- quoted delimiter (e.g., "\:" as a literal colon). But that
- creates a backwards compatibility problem: any path which
- uses that escape character is now broken, and we've just
- shifted the problem. We could choose an unlikely escape
- character (e.g., something from the non-printable ASCII
- range), but that's awkward to use.
- Instead, let's treat names as unquoted unless they begin
- with a double-quote, in which case they are interpreted via
- our usual C-stylke quoting rules. This also breaks
- backwards-compatibility, but in a smaller way: it only
- matters if your file has a double-quote as the very _first_
- character in the path (whereas an escape character is a
- problem anywhere in the path). It's also consistent with
- many other parts of git, which accept either a bare pathname
- or a double-quoted one, and the sender can choose to quote
- or not as required.
- Signed-off-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Merge branch 'jk/alt-odb-cleanup' into jk/quote-env-path-list-component
- * jk/alt-odb-cleanup:
- alternates: re-allow relative paths from environment
- date-formats.txt: Typo fix
- Last time I checked, I was living in the UTC+01:00 time zone. UTC+02:00
- would be Central European _Summer_ Time.
- Signed-off-by: Luis Ressel <aranea@aixah.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- git-svn: document useLogAuthor and addAuthorFrom config keys
- We've always supported these config keys in git-svn,
- so document them so users won't have to respecify them
- on every invocation.
- Reported-by: Juergen Kosel <juergen.kosel@gmx.de>
- Signed-off-by: Eric Wong <e@80x24.org>
- git-svn: allow "0" in SVN path components
- Blindly checking a path component for falsiness is unwise, as
- "0" is false to Perl, but a valid pathname component for SVN
- (or any filesystem).
- Found via random code reading.
- Signed-off-by: Eric Wong <e@80x24.org>
- submodule--helper: set alternateLocation for cloned submodules
- In 31224cbdc7 (clone: recursive and reference option triggers
- submodule alternates, 2016-08-17) a mechanism was added to
- have submodules referenced. It did not address _nested_
- submodules, however.
- This patch makes all not just the root repository, but also
- all submodules (recursively) have submodule.alternateLocation
- and submodule.alternateErrorStrategy configured, making Git
- search for possible alternates for nested submodules as well.
- As submodule's alternate target does not end in .git/objects
- (rather .git/modules/qqqqqq/objects), this alternate target
- path restriction for in add_possible_reference_from_superproject
- relates from "*.git/objects" to just */objects".
- New tests have been added to t7408-submodule-reference.
- Signed-off-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
- Reviewed-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- gitk: Update copyright notice to 2016
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Clear array 'commitinfo' on reload
- After a reload we might have an entirely different set of commits,
- so keeping all of them leaks memory. Remove them all because
- re-creating them is not more expensive than testing wether they're
- still valid. Lazy (re-)creation is already well established, so
- a missing entry can't cause harm.
- Signed-off-by: Markus Hitter <mah@jump-ing.de>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Remove closed file descriptors from $blobdifffd
- One shouldn't have descriptors of already closed files around.
- The first idea to deal with this (previously) ever growing array
- was to remove it entirely, but it's needed to detect start of a
- new diff with ths old diff not yet done. This happens when a user
- clicks on the same commit in the commit list repeatedly without
- delay.
- Signed-off-by: Markus Hitter <mah@jump-ing.de>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Turn off undo manager in the text widget
- The diff text widget is read-only, so there's zero point in
- building an undo stack. This change reduces memory consumption of
- this widget by about 95%.
- Memory usage of the whole program for viewing a reference commit
- before; 579'692'744 bytes, after: 32'724'446 bytes.
- Test procedure:
- - Choose a largish commit and check it out. In this case one with
- 90'802 lines, 5'006'902 bytes.
- - Have a Tcl version with memory debugging enabled. This is,
- build one with --enable-symbols=mem passed to configure.
- - Instrument Gitk to regularly show a memory dump. E.g. by adding
- these code lines at the very bottom:
- proc memDump {} {
- catch {
- set output [memory info]
- puts $output
- }
- after 3000 memDump
- }
- memDump
- - Start Gitk, it'll load this largish commit into the diff text
- field automatically (because it's the current commit).
- - Wait until memory consumption levels out and note the numbers.
- Note that the numbers reported by [memory info] are much smaller
- than the ones reported in 'top' (1.75 GB vs. 105 MB in this case),
- likely due to all the instrumentation coming with the debug
- version of Tcl.
- Signed-off-by: Markus Hitter <mah@jump-ing.de>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Fix Japanese translation for "marked commit"
- Signed-off-by: Satoshi Yasushima <s.yasushima@gmail.com>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Fix missing commits when using -S or -G
- When -S or -G is used as a filter option, the resulting commit list
- rarely contains all matching commits. Only a certain number of commits
- are displayed and the rest are missing.
- "git log --boundary -S" does not return as many boundary commits as you
- might expect. gitk makes up for this in closevarcs() by adding missing
- parent (boundary) commits. However, it does not change $numcommits,
- which limits how many commits are shown. In the end, some commits at the
- end of the commit list are simply not shown.
- Change $numcommits whenever a missing parent is added to the current
- view.
- Signed-off-by: Stefan Dotterweich <stefandotterweich@gmx.de>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Use explicit RGB green instead of "lime"
- Some systems don't recognize "lime" as a color, leading to errors when
- gitk is run. What we want is a bright green, so use "#00ff00" instead.
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Add Portuguese translation
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- mergetools: fix xxdiff hotkeys
- xxdiff was using a mix of "Ctrl-<key>" and "Ctrl+<key>" hotkeys.
- The dashed "-" form is not accepted by newer xxdiff versions.
- Use the plus "+" form only.
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: rename variables for consistency
- Always call the list of files @files.
- Always call the worktree $worktree.
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: chdir as early as possible
- Make difftool chdir to the top-level of the repository as soon as it can
- so that we can simplify how paths are handled. Replace construction of
- absolute paths via string concatenation with relative paths wherever
- possible. The bulk of the code no longer needs to use absolute paths.
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: sanitize $workdir as early as possible
- The double-slash fixup on the $workdir variable was being
- performed just-in-time to avoid double-slashes in symlink
- targets, but the rest of the code was silently using paths with
- embedded "//" in them.
- A recent user-reported error message contained double-slashes.
- Eliminate the issue by sanitizing inputs as soon as they arrive.
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: fix dir-diff index creation when in a subdirectory
- 9ec26e7977 (difftool: fix argument handling in subdirs, 2016-07-18)
- corrected how path arguments are handled in a subdirectory, but
- it introduced a regression in how entries outside of the
- subdirectory are handled by dir-diff.
- When preparing the right-side of the diff we only include the
- changed paths in the temporary area.
- The left side of the diff is constructed from a temporary
- index that is built from the same set of changed files, but it
- was being constructed from within the subdirectory. This is a
- problem because the indexed paths are toplevel-relative, and
- thus they were not getting added to the index.
- Teach difftool to chdir to the toplevel of the repository before
- preparing its temporary indexes. This ensures that all of the
- toplevel-relative paths are valid.
- Add test cases to more thoroughly exercise this scenario.
- Reported-by: Frank Becker <fb@mooflu.com>
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- mingw: intercept isatty() to handle /dev/null as Git expects it
- When Git's source code calls isatty(), it really asks whether the
- respective file descriptor is connected to an interactive terminal.
- Windows' _isatty() function, however, determines whether the file
- descriptor is associated with a character device. And NUL, Windows'
- equivalent of /dev/null, is a character device.
- Which means that for years, Git mistakenly detected an associated
- interactive terminal when being run through the test suite, which
- almost always redirects stdin, stdout and stderr to /dev/null.
- This bug only became obvious, and painfully so, when the new
- bisect--helper entered the `pu` branch and made the automatic build & test
- time out because t6030 was waiting for an answer.
- For details, see
- https://msdn.microsoft.com/en-us/library/f4s0ddew.aspx
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- gitk: Makefile: create install bin directory
- Force creation of destination bin directory. Without this, gitk
- would fail to install if this directory didn't already exist.
- Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Include commit title in branch dialog
- Hi,
- I made another branch dialog related change, included in this message.
- It applies on top of my other two patches.
- Rogier.
- ------- 8< ------------------- 8< --------------
- Only the SHA1 was included. It's convenient to have the title
- mentioned as well.
- Signed-off-by: Rogier Goossens <goossens.rogier@gmail.com>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Allow checking out a remote branch
- Git allows checking out remote branches, creating a local tracking
- branch in the process. Allow gitk to do this as well, provided a
- local branch of the same name does not yet exist.
- Signed-off-by: Rogier Goossens <goossens.rogier@gmail.com>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- gitk: Add a 'rename' option to the branch context menu
- Signed-off-by: Rogier Goossens <goossens.rogier@gmail.com>
- Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
- ref-filter: add support to display trailers as part of contents
- Add %(trailers) and %(contents:trailers) to display the trailers as
- interpreted by trailer_info_get. Update documentation and add a test for
- the new feature.
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- pretty: add %(trailers) format for displaying trailers of a commit message
- Recent patches have expanded on the trailers.c code and we have the
- builtin commant git-interpret-trailers which can be used to add or
- modify trailer lines. However, there is no easy way to simply display
- the trailers of a commit message.
- Add support for %(trailers) format modifier which will use the
- trailer_info_get() calls to read trailers in an identical way as git
- interpret-trailers does. Use a long format option instead of a short
- name so that future work can more easily unify ref-filter and pretty
- formats.
- Add documentation and tests for the same.
- Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- rebase: add --quit to cleanup rebase, leave everything else untouched
- There are occasions when you decide to abort an in-progress rebase and
- move on to do something else but you forget to do "git rebase --abort"
- first. Or the rebase has been in progress for so long you forgot about
- it. By the time you realize that (e.g. by starting another rebase)
- it's already too late to retrace your steps. The solution is normally
- rm -r .git/<some rebase dir>
- and continue with your life. But there could be two different
- directories for <some rebase dir> (and it obviously requires some
- knowledge of how rebase works), and the ".git" part could be much
- longer if you are not at top-dir, or in a linked worktree. And
- "rm -r" is very dangerous to do in .git, a mistake in there could
- destroy object database or other important data.
- Provide "git rebase --quit" for this use case, mimicking a precedent
- that is "git cherry-pick --quit".
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: omit needless "for"
- What was intended was perhaps "... plumbing does for you" ("you" added), but
- simply omitting the word "for" is more terse and gets the intended point across
- just as well, if not more so.
- I originally went with the approach of writing "for you", but Junio C
- Hamano suggested this approach instead.
- Signed-off-by: Kristoffer Haugsbakk <kristoffer.haugsbakk@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: make the intent of sentence clearer
- By adding the word "just", which might have been accidentally omitted.
- Adding the word "just" makes it clear that the point is to *not* do an
- octopus merge simply because you *can* do it. In other words, you
- should have a reason for doing it beyond simply having two (seemingly)
- independent commits that you need to merge into another branch, since
- it's not always the best approach.
- The previous sentence made it look more like it was trying to say that
- you shouldn't do an octopus merge *because* you can do an octopus merge.
- Although this interpretation doesn't make sense and the rest of the
- paragraph makes the intended meaning clear, this adjustment should make
- the intent of the sentence more immediately clear to the reader.
- Signed-off-by: Kristoffer Haugsbakk <kristoffer.haugsbakk@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: add verb in front of command to run
- Instead of using the command 'git clone' as a verb, use "run" as the
- verb indicating the action of executing the command 'git clone'.
- Signed-off-by: Kristoffer Haugsbakk <kristoffer.haugsbakk@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- doc: add articles (grammar)
- Add definite and indefinite articles in three places where they were
- missing.
- - Use "the" in front of a directory name
- - Use "the" in front of "style of cooperation"
- - Use an indefinite article in front of "CVS background"
- Signed-off-by: Kristoffer Haugsbakk <kristoffer.haugsbakk@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- test-lib-functions.sh: teach test_commit -C <dir>
- Specifically when setting up submodule tests, it comes in handy if
- we can create commits in repositories that are not at the root of
- the tested trash dir. Add "-C <dir>" similar to gits -C parameter
- that will perform the operation in the given directory.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule helper: support super prefix
- Just like main commands in Git, the submodule helper needs
- access to the superproject prefix. Enable this in the git.c
- but have its own fuse in the helper code by having a flag to
- turn on the super prefix.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- submodule: use absolute path for computing relative path connecting
- The current caller of connect_work_tree_and_git_dir passes
- an absolute path for the `git_dir` parameter. In the future patch
- we will also pass in relative path for `git_dir`. Extend the functionality
- of connect_work_tree_and_git_dir to take relative paths for parameters.
- We could work around this in the future patch by computing the absolute
- path for the git_dir in the calling site, however accepting relative
- paths for either parameter makes the API for this function much harder
- to misuse.
- Signed-off-by: Stefan Beller <sbeller@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer: remove useless get_dir() function
- This function is used only once, for the removal of the
- directory. It is not used for the creation of the directory nor
- anywhere else.
- Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- sequencer: make sequencer abort safer
- In contrast to "git am --abort", a sequencer abort did not check
- whether the current HEAD is the one that is expected. This can lead
- to loss of work (when not spotted and resolved using reflog before
- the garbage collector chimes in).
- This behavior is now changed by mimicking "git am --abort". The
- abortion is done but HEAD is not changed when the current HEAD is
- not the expected HEAD.
- A new file "sequencer/abort-safety" is added to save the expected
- HEAD.
- The new behavior is only active when --abort is invoked on multiple
- picks. The problem does not occur for the single-pick case because
- it is handled differently.
- Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t3510: test that cherry-pick --abort does not unsafely change HEAD
- Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- commit: remove 'Clever' message for --only --amend
- The behavior is now documented; more importantly, rewarding the user
- with a "Wow, you are clever" praise afterwards is not an effective
- way to advertise the feature--at that point the user already knows.
- Signed-off-by: Andreas Krey <a.krey@gmx.de>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- diff: handle --no-abbrev in no-index case
- There are two different places where the --no-abbrev option is parsed,
- and two different places where SHA-1s are abbreviated. We normally parse
- --no-abbrev with setup_revisions(), but in the no-index case, "git diff"
- calls diff_opt_parse() directly, and diff_opt_parse() didn't handle
- --no-abbrev until now. (It did handle --abbrev, however.) We normally
- abbreviate SHA-1s with find_unique_abbrev(), but commit 4f03666 ("diff:
- handle sha1 abbreviations outside of repository, 2016-10-20) recently
- introduced a special case when you run "git diff" outside of a
- repository.
- setup_revisions() does also call diff_opt_parse(), but not for --abbrev
- or --no-abbrev, which it handles itself. setup_revisions() sets
- rev_info->abbrev, and later copies that to diff_options->abbrev. It
- handles --no-abbrev by setting abbrev to zero. (This change doesn't
- touch that.)
- Setting abbrev to zero was broken in the outside-of-a-repository special
- case, which until now resulted in a truly zero-length SHA-1, rather than
- taking zero to mean do not abbreviate. The only way to trigger this bug,
- however, was by running "git diff --raw" without either the --abbrev or
- --no-abbrev options, because 1) without --raw it doesn't respect abbrev
- (which is bizarre, but has been that way forever), 2) we silently clamp
- --abbrev=0 to MINIMUM_ABBREV, and 3) --no-abbrev wasn't handled until
- now.
- The outside-of-a-repository case is one of three no-index cases. The
- other two are when one of the files you're comparing is outside of the
- repository you're in, and the --no-index option.
- Signed-off-by: Jack Bates <jack@nottheoilrig.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- versioncmp: use earliest-longest contained suffix to determine sorting order
- When comparing tagnames, it is possible that a tagname contains more
- than one of the configured prerelease suffixes around the first
- different character. After fixing a bug in the previous commit such a
- tagname is sorted according to the contained suffix which comes first
- in the configuration. This is, however, not quite the right thing to
- do in the following corner cases:
- 1. $ git -c versionsort.suffix=-bar
- -c versionsort.suffix=-foo-baz
- -c versionsort.suffix=-foo-bar
- tag -l --sort=version:refname 'v1*'
- v1.0-foo-bar
- v1.0-foo-baz
- The suffix of the tagname 'v1.0-foo-bar' is clearly '-foo-bar',
- so it should be listed last. However, as it also contains '-bar'
- around the first different character, it is listed first instead,
- because that '-bar' suffix comes first the configuration.
- 2. One of the configured suffixes starts with the other:
- $ git -c versionsort.prereleasesuffix=-pre \
- -c versionsort.prereleasesuffix=-prerelease \
- tag -l --sort=version:refname 'v2*'
- v2.0-prerelease1
- v2.0-pre1
- v2.0-pre2
- Here the tagname 'v2.0-prerelease1' should be the last. When
- comparing 'v2.0-pre1' and 'v2.0-prerelease1' the first different
- characters are '1' and 'r', respectively. Since this first
- different character must be part of the configured suffix, the
- '-pre' suffix is not recognized in the first tagname. OTOH, the
- '-prerelease' suffix is properly recognized in
- 'v2.0-prerelease1', thus it is listed first.
- Improve version sort in these corner cases, and
- - look for a configured prerelease suffix containing the first
- different character or ending right before it, so the '-pre'
- suffixes are recognized in case (2). This also means that
- when comparing tagnames 'v2.0-pre1' and 'v2.0-pre2',
- swap_prereleases() would find the '-pre' suffix in both, but then
- it will return "undecided" and the caller will do the right thing
- by sorting based in '1' and '2'.
- - If the tagname contains more than one suffix, then give precedence
- to the contained suffix that starts at the earliest offset in the
- tagname to address (1).
- - If there are more than one suffixes starting at that earliest
- position, then give precedence to the longest of those suffixes,
- thus ensuring that in (2) the tagname 'v2.0-prerelease1' won't be
- sorted based on the '-pre' suffix.
- Add tests for these corner cases and adjust the documentation
- accordingly.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- versioncmp: cope with common part overlapping with prerelease suffix
- Version sort with prerelease reordering sometimes puts tagnames in the
- wrong order, when the common part of two compared tagnames overlaps
- with the leading character(s) of one or more configured prerelease
- suffixes. Note the position of "v2.1.0-beta-1":
- $ git -c versionsort.prereleaseSuffix=-beta \
- tag -l --sort=version:refname v2.1.*
- v2.1.0-beta-2
- v2.1.0-beta-3
- v2.1.0
- v2.1.0-RC1
- v2.1.0-RC2
- v2.1.0-beta-1
- v2.1.1
- v2.1.2
- The reason is that when comparing a pair of tagnames, first
- versioncmp() looks for the first different character in a pair of
- tagnames, and then the swap_prereleases() helper function looks for a
- configured prerelease suffix _starting at_ that character. Thus, when
- in the above example the sorting algorithm happens to compare the
- tagnames "v2.1.0-beta-1" and "v2.1.0-RC2", swap_prereleases() tries to
- match the suffix "-beta" against "beta-1" to no avail, and the two
- tagnames erroneously end up being ordered lexicographically.
- To fix this issue change swap_prereleases() to look for configured
- prerelease suffixes _containing_ the position of that first different
- character.
- Care must be taken, when a configured suffix is longer than the
- tagnames' common part up to the first different character, to avoid
- reading memory before the beginning of the tagnames. Add a test that
- uses an exceptionally long prerelease suffix to check for this, in the
- hope that in case of a regression the illegal memory access causes a
- segfault in 'git tag' on one of the commonly used platforms (the test
- happens to pass successfully on my Linux system with the safety check
- removed), or at least makes valgrind complain.
- Under some circumstances it's possible that more than one prerelease
- suffixes can be found in the same tagname around that first different
- character. With this simple bugfix patch such a tagname is sorted
- according to the contained suffix that comes first in the
- configuration for now. This is less than ideal in some cases, and the
- following patch will take care of those.
- Reported-by: Leho Kraav <leho@conversionready.com>
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- versioncmp: pass full tagnames to swap_prereleases()
- The swap_prereleases() helper function is responsible for finding
- configured prerelease suffixes in a pair of tagnames to be compared,
- but this function currently gets to see only the parts of those two
- tagnames starting at the first different character. To fix some
- issues related to the common part of two tagnames overlapping with
- leading part of a prerelease suffix, this helper function must see
- both full tagnames.
- In preparation for the fix in the following patch, refactor
- swap_prereleases() and its caller to pass two full tagnames and an
- additional offset indicating the position of the first different
- character.
- While updating the comment describing that function, remove the
- sentence about not dealing with both tagnames having the same suffix.
- Currently it doesn't add much value (we know that there is a different
- character, so it's obvious that it can't possibly be the same suffix
- in both), and at the end of this patch series it won't even be true
- anymore.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7004-tag: add version sort tests to show prerelease reordering issues
- Version sort with prerelease reordering sometimes puts tagnames in the
- wrong order, when the common part of two compared tagnames ends with
- the leading character(s) of one or more configured prerelease
- suffixes. Add tests that demonstrate these issues.
- The unrelated '--format should list tags as per format given' test
- later uses tags matching the same prefix as the version sort tests,
- thus was affected by the new tags added for the new tests in this
- patch. Change that test to perform its checks on a different set of
- tags.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7004-tag: use test_config helper
- ... instead of setting and then manually unsetting configuration
- variables, on one occasion even outside the test_expect_success block.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- t7004-tag: delete unnecessary tags with test_when_finished
- The '--force is moot with a non-existing tag name' test creates two
- new tags, which are then deleted right after the test is finished,
- outside the test_expect_success block, allowing 'git tag -d's output to
- pollute the test output.
- Use test_when_finished to delete those tags.
- Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- difftool: fix dir-diff index creation when in a subdirectory
- 9ec26e7977 (difftool: fix argument handling in subdirs, 2016-07-18)
- corrected how path arguments are handled in a subdirectory, but
- it introduced a regression in how entries outside of the
- subdirectory are handled by dir-diff.
- When preparing the right-side of the diff we only include the
- changed paths in the temporary area.
- The left side of the diff is constructed from a temporary
- index that is built from the same set of changed files, but it
- was being constructed from within the subdirectory. This is a
- problem because the indexed paths are toplevel-relative, and
- thus they were not getting added to the index.
- Teach difftool to chdir to the toplevel of the repository before
- preparing its temporary indexes. This ensures that all of the
- toplevel-relative paths are valid.
- Add test cases to more thoroughly exercise this scenario.
- Reported-by: Frank Becker <fb@mooflu.com>
- Signed-off-by: David Aguilar <davvid@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- am: change safe_to_abort()'s not rewinding error into a warning
- The error message tells the user that something went terribly wrong
- and the --abort could not be performed. But the --abort is performed,
- only without rewinding. By simply changing the error into a warning,
- we indicate the user that she must not try something like
- "git am --abort --force", instead she just has to check the HEAD.
- Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- am: fix filename in safe_to_abort() error message
- Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- shallow.c: remove useless code
- Some context before we talk about the removed code.
- This paint_down() is part of step 6 of 58babff (shallow.c: the 8 steps
- to select new commits for .git/shallow - 2013-12-05). When we fetch from
- a shallow repository, we need to know if one of the new/updated refs
- needs new "shallow commits" in .git/shallow (because we don't have
- enough history of those refs) and which one.
- The question at step 6 is, what (new) shallow commits are required in
- other to maintain reachability throughout the repository _without_
- cutting our history short? To answer, we mark all commits reachable from
- existing refs with UNINTERESTING ("rev-list --not --all"), mark shallow
- commits with BOTTOM, then for each new/updated refs, walk through the
- commit graph until we either hit UNINTERESTING or BOTTOM, marking the
- ref on the commit as we walk.
- After all the walking is done, we check the new shallow commits. If we
- have not seen any new ref marked on a new shallow commit, we know all
- new/updated refs are reachable using just our history and .git/shallow.
- The shallow commit in question is not needed and can be thrown away.
- So, the code.
- The loop here (to walk through commits) is basically
- 1. get one commit from the queue
- 2. ignore if it's SEEN or UNINTERESTING
- 3. mark it
- 4. go through all the parents and..
- 5a. mark it if it's never marked before
- 5b. put it back in the queue
- What we do in this patch is drop step 5a because it is not
- necessary. The commit being marked at 5a is put back on the queue, and
- will be marked at step 3 at the next iteration. The only case it will
- not be marked is when the commit is already marked UNINTERESTING (5a
- does not check this), which will be ignored at step 2.
- But we don't care about refs marking on UNINTERESTING. We care about the
- marking on _shallow commits_ that are not reachable from our current
- history (and having UNINTERESTING on it means it's reachable). So it's
- ok for an UNINTERESTING not to be ref-marked.
- Reported-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- shallow.c: bit manipulation tweaks
- First of all, 1 << 31 is technically undefined behaviour, so let's just
- use an unsigned literal.
- If i is 'signed int' and gcc doesn't know that i is positive, gcc
- generates code to compute the C99-mandated values of "i / 32" and "i %
- 32", which is a lot more complicated than simple a simple shifts/mask.
- The only caller of paint_down actually passes an "unsigned int" value,
- but the prototype of paint_down causes (completely well-defined)
- conversion to signed int, and gcc has no way of knowing that the
- converted value is non-negative. Just make the id parameter unsigned.
- In update_refstatus, the change in generated code is much smaller,
- presumably because gcc is smart enough to see that i starts as 0 and is
- only incremented, so it is allowed (per the UD of signed overflow) to
- assume that i is always non-negative. But let's just help less smart
- compilers generate good code anyway.
- Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- shallow.c: avoid theoretical pointer wrap-around
- The expression info->free+size is technically undefined behaviour in
- exactly the case we want to test for. Moreover, the compiler is likely
- to translate the expression to
- (unsigned long)info->free + size > (unsigned long)info->end
- where there's at least a theoretical chance that the LHS could wrap
- around 0, giving a false negative.
- This might as well be written using pointer subtraction avoiding these
- issues.
- Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- shallow.c: make paint_alloc slightly more robust
- paint_alloc() allocates a big block of memory and splits it into
- smaller, fixed size, chunks of memory whenever it's called. Each chunk
- contains enough bits to present all "new refs" [1] in a fetch from a
- shallow repository.
- We do not check if the new "big block" is smaller than the requested
- memory chunk though. If it happens, we'll happily pass back a memory
- region smaller than expected. Which will lead to problems eventually.
- A normal fetch may add/update a dozen new refs. Let's stay on the
- "reasonably extreme" side and say we need 16k refs (or bits from
- paint_alloc's perspective). Each chunk of memory would be 2k, much
- smaller than the memory pool (512k).
- So, normally, the under-allocation situation should never happen. A bad
- guy, however, could make a fetch that adds more than 4m new/updated refs
- to this code which results in a memory chunk larger than pool size.
- Check this case and abort.
- Noticed-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
- Reviewed-by: Jeff King <peff@peff.net>
- [1] Details are in commit message of 58babff (shallow.c: the 8 steps to
- select new commits for .git/shallow - 2013-12-05), step 6.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools
- We need to allocate a "big" block of memory in paint_alloc(). The exact
- size does not really matter. But the pool size has no relation with
- commit-slab. Stop using that macro here.
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- shallow.c: rename fields in paint_info to better express their purposes
- paint_alloc() is basically malloc(), tuned for allocating a fixed number
- of bits on every call without worrying about freeing any individual
- allocation since all will be freed at the end. It does it by allocating
- a big block of memory every time it runs out of "free memory". "slab" is
- a poor choice of name, at least poorer than "pool".
- Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Reviewed-by: Jeff King <peff@peff.net>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
- lockfile: LOCK_REPORT_ON_ERROR
- The "libify sequencer" topic stopped passing the die_on_error option
- to hold_locked_index(), and this lost an error message from "git
- merge --ff-only $commit" when there are competing updates in
- progress.
- The command still exits with a non-zero status, but that is not of
- much help for an interactive user. The last thing the command says
- is "Updating $from..$to". We used to follow it with a big error
- message that makes it clear that "merge --ff-only" did not succeed.
- What is sad is that we should have noticed this regression while
- reviewing the change. It was clear that the update to the
- checkout_fast_forward() function made a failing hold_locked_index()
- silent, but the only caller of the checkout_fast_forward() function
- had this comment:
- if (checkout_fast_forward(from, to, 1))
- - exit(128); /* the callee should have complained already */
- + return -1; /* the callee should have complained already */
- which clearly contradicted the assumption X-<.
- Add a new option LOCK_REPORT_ON_ERROR that can be passed instead of
- LOCK_DIE_ON_ERROR to the hold_lock*() family of functions and teach
- checkout_fast_forward() to use it to fix this regression.
- After going thourgh all calls to hold_lock*() family of functions
- that used to pass LOCK_DIE_ON_ERROR but were modified to pass 0 in
- the "libify sequencer" topic "git show --first-parent 2a4062a4a8",
- it appears that this is the only one that has become silent. Many
- others used to give detailed report that talked about "there may be
- competing Git process running" but with the series merged they now
- only give a single liner "Unable to lock ...", some of which may
- have to be tweaked further, but at least they say something, unlike
- the one this patch fixes.
- Reported-by: Robbie Iannucci <iannucci@google.com>
- Signed-off-by: Junio C Hamano <gitster@pobox.com>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement