1
0
mirror of https://github.com/git/git.git synced 2024-10-21 02:18:14 +02:00
Commit Graph

40001 Commits

Author SHA1 Message Date
Jeff King
e4f031e34b strbuf: make strbuf_addftime more robust
The return value of strftime is poorly designed; when it
returns 0, the caller cannot tell if the buffer was not
large enough, or if the output was actually 0 bytes. In the
original implementation of strbuf_addftime, we simply punted
and guessed that our 128-byte hint would be large enough.

We can do better, though, if we're willing to treat strftime
like less of a black box. We can munge the incoming format
to make sure that it never produces 0-length output, and
then "fix" the resulting output.  That lets us reliably grow
the buffer based on strftime's return value.

Clever-idea-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-20 22:17:06 -07:00
Jeff King
aa1462cc3d introduce "format" date-mode
This feeds the format directly to strftime. Besides being a
little more flexible, the main advantage is that your system
strftime may know more about your locale's preferred format
(e.g., how to spell the days of the week).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-29 11:39:10 -07:00
Jeff King
a5481a6c94 convert "enum date_mode" into a struct
In preparation for adding date modes that may carry extra
information beyond the mode itself, this patch converts the
date_mode enum into a struct.

Most of the conversion is fairly straightforward; we pass
the struct as a pointer and dereference the type field where
necessary. Locations that declare a date_mode can use a "{}"
constructor.  However, the tricky case is where we use the
enum labels as constants, like:

  show_date(t, tz, DATE_NORMAL);

Ideally we could say:

  show_date(t, tz, &{ DATE_NORMAL });

but of course C does not allow that. Likewise, we cannot
cast the constant to a struct, because we need to pass an
actual address. Our options are basically:

  1. Manually add a "struct date_mode d = { DATE_NORMAL }"
     definition to each caller, and pass "&d". This makes
     the callers uglier, because they sometimes do not even
     have their own scope (e.g., they are inside a switch
     statement).

  2. Provide a pre-made global "date_normal" struct that can
     be passed by address. We'd also need "date_rfc2822",
     "date_iso8601", and so forth. But at least the ugliness
     is defined in one place.

  3. Provide a wrapper that generates the correct struct on
     the fly. The big downside is that we end up pointing to
     a single global, which makes our wrapper non-reentrant.
     But show_date is already not reentrant, so it does not
     matter.

This patch implements 3, along with a minor macro to keep
the size of the callers sane.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-29 11:39:07 -07:00
Jeff King
b7c1e11dc4 show-branch: use DATE_RELATIVE instead of magic number
This is more readable, and won't break if we ever change the
order of the date_mode enum.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-29 11:39:04 -07:00
Junio C Hamano
912bd497e9 Sync with maint
* maint:
2015-06-28 14:51:12 -07:00
Junio C Hamano
351d06df51 Merge branch 'jk/stash-require-clean-index' into maint
A hotfix for the topic already in 'master'.

* jk/stash-require-clean-index:
  Revert "stash: require a clean index to apply"
2015-06-25 23:03:27 -07:00
Junio C Hamano
b1f0802e91 Merge branch 'cb/array-size' into maint
* cb/array-size:
  Fix definition of ARRAY_SIZE for non-gcc builds
2015-06-25 23:03:25 -07:00
Junio C Hamano
7ecec52d42 Git 2.5.0-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.5.0-rc0
2015-06-25 11:08:39 -07:00
Junio C Hamano
c82b6d3f4b Merge branch 'cn/cvsimport-perl-update'
* cn/cvsimport-perl-update:
  cvsimport: silence regex warning appearing in Perl 5.22.
2015-06-25 11:08:08 -07:00
Junio C Hamano
5416f8af0f Merge branch 'cb/array-size'
* cb/array-size:
  Fix definition of ARRAY_SIZE for non-gcc builds
2015-06-25 11:07:42 -07:00
Junio C Hamano
a6a1ad9b25 Sync with 2.4.5 2015-06-25 11:04:30 -07:00
Junio C Hamano
0df0541bf1 Git 2.4.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.4.5
2015-06-25 11:03:05 -07:00
Junio C Hamano
ebf4fc90da Merge branch 'sg/merge-summary-config' into maint
Doc updates.

* sg/merge-summary-config:
  Documentation: include 'merge.branchdesc' for merge and config as well
2015-06-25 11:02:17 -07:00
Junio C Hamano
5fd72277d4 Merge branch 'jk/make-fix-dependencies' into maint
Build clean-up.

* jk/make-fix-dependencies:
  Makefile: silence perl/PM.stamp recipe
  Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS
  Makefile: drop dependency between git-instaweb and gitweb
2015-06-25 11:02:16 -07:00
Junio C Hamano
68538cf954 Merge branch 'sb/pack-protocol-mention-smart-http' into maint
Doc updates.

* sb/pack-protocol-mention-smart-http:
  Documentation/technical/pack-protocol: mention http as possible protocol
2015-06-25 11:02:14 -07:00
Junio C Hamano
f2bd231414 Merge branch 'jk/die-on-bogus-worktree-late' into maint
The setup code used to die when core.bare and core.worktree are set
inconsistently, even for commands that do not need working tree.

* jk/die-on-bogus-worktree-late:
  setup_git_directory: delay core.bare/core.worktree errors
2015-06-25 11:02:13 -07:00
Junio C Hamano
6356003c80 Merge branch 'pt/pull-tags-error-diag' into maint
There was a dead code that used to handle "git pull --tags" and
show special-cased error message, which was made irrelevant when
the semantics of the option changed back in Git 1.9 days.

* pt/pull-tags-error-diag:
  pull: remove --tags error in no merge candidates case
2015-06-25 11:02:12 -07:00
Junio C Hamano
6998d890c7 Merge branch 'jk/color-diff-plain-is-context' into maint
"color.diff.plain" was a misnomer; give it 'color.diff.context' as
a more logical synonym.

* jk/color-diff-plain-is-context:
  diff.h: rename DIFF_PLAIN color slot to DIFF_CONTEXT
  diff: accept color.diff.context as a synonym for "plain"
2015-06-25 11:02:11 -07:00
Junio C Hamano
c5baf18a40 Merge branch 'jk/diagnose-config-mmap-failure' into maint
The configuration reader/writer uses mmap(2) interface to access
the files; when we find a directory, it barfed with "Out of memory?".

* jk/diagnose-config-mmap-failure:
  xmmap(): drop "Out of memory?"
  config.c: rewrite ENODEV into EISDIR when mmap fails
  config.c: avoid xmmap error messages
  config.c: fix mmap leak when writing config
  read-cache.c: drop PROT_WRITE from mmap of index
2015-06-25 11:02:11 -07:00
Junio C Hamano
c53312583b Merge branch 'jk/squelch-missing-link-warning-for-unreachable' into maint
Recent "git prune" traverses young unreachable objects to safekeep
old objects in the reachability chain from them, which sometimes
caused error messages that are unnecessarily alarming.

* jk/squelch-missing-link-warning-for-unreachable:
  suppress errors on missing UNINTERESTING links
  silence broken link warnings with revs->ignore_missing_links
  add quieter versions of parse_{tree,commit}
2015-06-25 11:02:10 -07:00
Junio C Hamano
f249409b6b Merge branch 'mm/rebase-i-post-rewrite-exec' into maint
"git rebase -i" fired post-rewrite hook when it shouldn't (namely,
when it was told to stop sequencing with 'exec' insn).

* mm/rebase-i-post-rewrite-exec:
  t5407: use <<- to align the expected output
  rebase -i: fix post-rewrite hook with failed exec command
  rebase -i: demonstrate incorrect behavior of post-rewrite
2015-06-25 11:02:09 -07:00
Junio C Hamano
b5496cbd22 Merge branch 'nd/diff-i-t-a'
* nd/diff-i-t-a:
  Revert "diff-lib.c: adjust position of i-t-a entries in diff"
2015-06-25 10:47:46 -07:00
Christian Neukirchen
16272c7db4 cvsimport: silence regex warning appearing in Perl 5.22.
Since Perl 5.22, "A literal '{' should now be escaped in a pattern".
Silence the recently added warning by using \{ instead.

Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-24 17:14:27 -07:00
Charles Bailey
e2c6f7cd5a Fix definition of ARRAY_SIZE for non-gcc builds
The improved ARRAY_SIZE macro uses BARF_UNLESS_AN_ARRAY which expands
to a valid check for recent gcc versions and to 0 for older gcc
versions but is not defined on non-gcc builds.

Non-gcc builds need this macro to expand to 0 as well. The current outer
test (defined(__GNUC__) && (__GNUC__ >= 3)) is a strictly weaker
condition than the inner test (GIT_GNUC_PREREQ(3, 1)) so we can omit the
outer test and cause the BARF_UNLESS_AN_ARRAY macro to be defined
correctly on non-gcc builds as well as gcc builds with older versions.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-24 17:14:00 -07:00
Junio C Hamano
df97e5dfea Ninth batch for 2.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-24 12:27:20 -07:00
Junio C Hamano
bfb539bb73 Merge branch 'jk/stash-require-clean-index'
A hotfix for the topic already in 'master'.

* jk/stash-require-clean-index:
  Revert "stash: require a clean index to apply"
2015-06-24 12:21:59 -07:00
Junio C Hamano
3072ec397c Merge branch 'pa/auto-gc-mac-osx'
Recent Mac OS X updates breaks the logic to detect that the machine
is on the AC power in the sample pre-auto-gc script.

* pa/auto-gc-mac-osx:
  hooks/pre-auto-gc: adjust power checking for newer OS X
2015-06-24 12:21:58 -07:00
Junio C Hamano
b3689ce31c Merge branch 'pt/t0302-needs-sanity'
* pt/t0302-needs-sanity:
  t0302: "unreadable" test needs SANITY prereq
2015-06-24 12:21:57 -07:00
Junio C Hamano
b79bbed185 Merge branch 'ld/p4-changes-block-size'
More Perforce row number limit workaround for "git p4".

* ld/p4-changes-block-size:
  git-p4: fixing --changes-block-size handling
  git-p4: add tests for non-numeric revision range
  git-p4: test with limited p4 server results
  git-p4: additional testing of --changes-block-size
2015-06-24 12:21:57 -07:00
Junio C Hamano
61461791be Merge branch 'fk/doc-format-patch-vn'
Docfix.

* fk/doc-format-patch-vn:
  doc: format-patch: fix typo
2015-06-24 12:21:56 -07:00
Junio C Hamano
07528be101 Merge branch 'sg/commit-cleanup-scissors'
"git commit --cleanup=scissors" was not careful enough to protect
against getting fooled by a line that looked like scissors.

* sg/commit-cleanup-scissors:
  commit: cope with scissors lines in commit message
2015-06-24 12:21:55 -07:00
Junio C Hamano
712b351bd3 Merge branch 'jk/index-pack-reduce-recheck'
Disable "have we lost a race with competing repack?" check while
receiving a huge object transfer that runs index-pack.

* jk/index-pack-reduce-recheck:
  index-pack: avoid excessive re-reading of pack directory
2015-06-24 12:21:54 -07:00
Junio C Hamano
c595cb9c4f Merge branch 'af/tcsh-completion-noclobber'
The tcsh completion writes a bash scriptlet but that would have
failed for users with noclobber set.

* af/tcsh-completion-noclobber:
  git-completion.tcsh: fix redirect with noclobber
2015-06-24 12:21:53 -07:00
Junio C Hamano
9d71c5f408 Merge branch 'mh/reporting-broken-refs-from-for-each-ref'
"git for-each-ref" reported "missing object" for 0{40} when it
encounters a broken ref.  The lack of object whose name is 0{40} is
not the problem; the ref being broken is.

* mh/reporting-broken-refs-from-for-each-ref:
  read_loose_refs(): treat NULL_SHA1 loose references as broken
  read_loose_refs(): simplify function logic
  for-each-ref: report broken references correctly
  t6301: new tests of for-each-ref error handling
2015-06-24 12:21:52 -07:00
Junio C Hamano
54a17cdb9c Merge branch 'sg/completion-commit-cleanup'
* sg/completion-commit-cleanup:
  completion: teach 'scissors' mode to 'git commit --cleanup='
2015-06-24 12:21:51 -07:00
Junio C Hamano
ce5e33832a Merge branch 'pt/am-abort-fix'
Various fixes around "git am" that applies a patch to a history
that is not there yet.

* pt/am-abort-fix:
  am --abort: keep unrelated commits on unborn branch
  am --abort: support aborting to unborn branch
  am --abort: revert changes introduced by failed 3way merge
  am --skip: support skipping while on unborn branch
  am -3: support 3way merge on unborn branch
  am --skip: revert changes introduced by failed 3way merge
2015-06-24 12:21:50 -07:00
Junio C Hamano
6f59058e49 Merge branch 'nd/untracked-cache'
Hotfix for the 'untracked-cache' topic that is already in 'master'.

* nd/untracked-cache:
  read-cache: fix untracked cache invalidation when split-index is used
2015-06-24 12:21:49 -07:00
Junio C Hamano
8f61ccf15d Merge branch 'mh/fsck-reflog-entries'
"git fsck" used to ignore missing or invalid objects recorded in reflog.

* mh/fsck-reflog-entries:
  fsck: report errors if reflog entries point at invalid objects
  fsck_handle_reflog_sha1(): new function
2015-06-24 12:21:48 -07:00
Junio C Hamano
510ab3f3c1 Merge branch 'js/sleep-without-select'
Portability fix.

* js/sleep-without-select:
  lockfile: wait using sleep_millisec() instead of select()
  lockfile: convert retry timeout computations to millisecond
  help.c: wrap wait-only poll() invocation in sleep_millisec()
  lockfile: replace random() by rand()
2015-06-24 12:21:47 -07:00
Junio C Hamano
5d24b109a6 Merge branch 'es/utf8-stupid-compiler-workaround'
A compilation workaround.

* es/utf8-stupid-compiler-workaround:
  utf8: NO_ICONV: silence uninitialized variable warning
2015-06-24 12:21:46 -07:00
Junio C Hamano
4b64c8a1ee Merge branch 'rl/am-3way-config'
"git am" learned am.threeWay configuration variable.

* rl/am-3way-config:
  git-am: add am.threeWay config variable
  t4150-am: refactor am -3 tests
  git-am.sh: fix initialization of the threeway variable
2015-06-24 12:21:45 -07:00
Junio C Hamano
49ac7358da Merge branch 'jc/ll-merge-expose-path'
Traditionally, external low-level 3-way merge drivers are expected
to produce their results based solely on the contents of the three
variants given in temporary files named by %O, %A and %B on their
command line.  Additionally allow them to look at the final path
(given by %P).

* jc/ll-merge-expose-path:
  ll-merge: pass the original path to external drivers
2015-06-24 12:21:45 -07:00
Junio C Hamano
6da9f888da Merge branch 'es/osx-header-pollutes-mask-macro'
* es/osx-header-pollutes-mask-macro:
  ewah: use less generic macro name
  ewah/bitmap: silence warning about MASK macro redefinition
2015-06-24 12:21:44 -07:00
Junio C Hamano
3c84c38dac Merge branch 'es/configure-getdelim'
Auto-detect availability of getdelim() that helps optimized version
of strbuf_getwholeline().

* es/configure-getdelim:
  configure: add getdelim() check
  config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases
2015-06-24 12:21:43 -07:00
Junio C Hamano
a1eaf8655d Merge branch 'pt/pull-optparse'
"git pull" has become more aware of the options meant for
underlying "git fetch" and then learned to use parse-options
parser.

* pt/pull-optparse:
  pull: use git-rev-parse --parseopt for option parsing
  pull: handle git-fetch's options as well
2015-06-24 12:21:42 -07:00
Junio C Hamano
20d16da5ca Merge branch 'qn/blame-show-email'
"git blame" learned blame.showEmail configuration variable.

* qn/blame-show-email:
  blame: add blame.showEmail configuration
2015-06-24 12:21:41 -07:00
Junio C Hamano
de04706e31 Merge branch 'jc/do-not-feed-tags-to-clear-commit-marks'
"git format-patch --ignore-if-upstream A..B" did not like to be fed
tags as boundary commits.

* jc/do-not-feed-tags-to-clear-commit-marks:
  format-patch: do not feed tags to clear_commit_marks()
2015-06-24 12:21:40 -07:00
Junio C Hamano
8c17d5a3c0 Merge branch 'es/send-email-sendmail-alias'
"git send-email" learned to handle more forms of sendmail style
aliases file.

* es/send-email-sendmail-alias:
  send-email: further warn about unsupported sendmail aliases features
  t9001: add sendmail aliases line continuation tests
  t9001: refactor sendmail aliases test infrastructure
  send-email: implement sendmail aliases line continuation support
  send-email: simplify sendmail aliases comment and blank line recognizer
  send-email: refactor sendmail aliases parser
  send-email: fix style: cuddle 'elsif' and 'else' with closing brace
  send-email: drop noise comments which merely repeat what code says
  send-email: visually distinguish sendmail aliases parser warnings
  send-email: further document missing sendmail aliases functionality
2015-06-24 12:21:39 -07:00
Junio C Hamano
59c465d5c0 Merge branch 'jc/apply-reject-noop-hunk'
"git apply" cannot diagnose a patch corruption when the breakage is
to mark the length of the hunk shorter than it really is on the
hunk header line "@@ -l,k +m,n @@"; one special case it could is
when the hunk becomes no-op (e.g. k == n == 2 for two-line context
patch output), and it learned how to do so.

* jc/apply-reject-noop-hunk:
  apply: reject a hunk that does not do anything
2015-06-24 12:21:39 -07:00
Junio C Hamano
78cc1a540b Revert "diff-lib.c: adjust position of i-t-a entries in diff"
This reverts commit d95d728aba06a34394d15466045cbdabdada58a2.

It turns out that many other commands that need to interact with the
result of running diff-files and diff-index, e.g.  "git apply", "git
rm", etc., need to be adjusted to the new world order it brings in.
For example, it would break this sequence to correct a whitespace
breakage in the parts you changed:

	git add -N file
	git diff --cached file | git apply --cached --whitespace=fix
	git checkout file

In the old world order, "diff" showed a patch to modify an existing
empty file by adding its full contents, and "apply" updated the
index by modifying the existing empty blob (which is what an
Intent-to-Add entry records in the index) with that patch.

In the new world order, "diff" shows a patch to create a new file
with its full contents, but because "apply" thinks that the i-t-a
entry already exists in the index, it refused to accept a creation.

Adjusting "apply" to this new world order is easy, but we need to
assess the extent of the damage to the rest of the system the new
world order brought in before going forward and adjust them all,
after which we can resurrect the commit being reverted here.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-23 10:37:21 -07:00