Commit Graph

30162 Commits

Author SHA1 Message Date
Michael Haggerty
1959bf6430 string_list API: document what "sorted" means
The recent work on using string_list to represent the list of refs
that matched with the refs on the other side during fetch heavily
depends on the sort order by string_list's implementation, and
changing string_list will break it.  Document that it uses strcmp()
order, at least for now.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-18 11:41:06 -07:00
Ramsay Jones
6511987854 test-string-list.c: Fix some sparse warnings
In particular, sparse complains as follows:

        SP test-string-list.c
    test-string-list.c:10:6: warning: symbol 'parse_string_list' was not \
        declared. Should it be static?
    test-string-list.c:18:6: warning: symbol 'write_list' was not \
        declared. Should it be static?
    test-string-list.c:25:6: warning: symbol 'write_list_compact' was not \
        declared. Should it be static?
    test-string-list.c:38:5: warning: symbol 'prefix_cb' was not \
        declared. Should it be static?

In order to suppress the warnings, since the above symbols do not
need more than file scope, we simply include the static modifier
in their declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-15 23:33:58 -07:00
Michael Haggerty
5f0fc64513 fetch-pack: eliminate spurious error messages
It used to be that if "--all", "--depth", and also explicit references
were sought, then the explicit references were not handled correctly
in filter_refs() because the "--all --depth" code took precedence over
the explicit reference handling, and the explicit references were
never noted as having been found.  So check for explicitly sought
references before proceeding to the "--all --depth" logic.

This fixes two test cases in t5500.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:32 -07:00
Michael Haggerty
b285668dd2 cmd_fetch_pack(): simplify computation of return value
Set the final value at initialization rather than initializing it then
sometimes changing it.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:32 -07:00
Michael Haggerty
778e7543d2 fetch-pack: report missing refs even if no existing refs were received
This fixes a test in t5500.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:32 -07:00
Michael Haggerty
7418f1a037 cmd_fetch_pack(): return early if finish_connect() fails
This simplifies the logic without changing the behavior.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
f537cfa750 filter_refs(): simplify logic
Simplify flow within loop: first decide whether to keep the reference,
then keep/free it.  This makes it clearer that each ref has exactly
two possible destinies, and removes duplication of the code for
appending the reference to the linked list.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
5096e48753 filter_refs(): build refs list as we go
Instead of temporarily storing matched refs to temporary array
"return_refs", simply append them to newlist as we go.  This changes
the order of references in newlist to strictly sorted if "--all" and
"--depth" and named references are all specified, but that usage is
broken anyway (see the last two tests in t5500).

This changes the last test in t5500 from segfaulting into just
emitting a spurious error (this will be fixed in a moment).

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
4ba159996f filter_refs(): delete matched refs from sought list
Remove any references that are available from the remote from the
sought list (rather than overwriting their names with NUL characters,
as previously).  Mark matching entries by writing a non-NULL pointer
to string_list_item::util during the iteration, then use
filter_string_list() later to filter out the entries that have been
marked.

Document this aspect of fetch_pack() in a comment in the header file.
(More documentation is obviously still needed.)

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
4c58f13ba6 fetch_pack(): update sought->nr to reflect number of unique entries
fetch_pack() removes duplicates from the "sought" list, thereby
shrinking the list.  But previously, the caller was not informed about
the shrinkage.  This would cause a spurious error message to be
emitted by cmd_fetch_pack() if "git fetch-pack" is called with
duplicate refnames.

Instead, remove duplicates using string_list_remove_duplicates(),
which adjusts sought->nr to reflect the new length of the list.

The last test of t5500 inexplicably *required* "git fetch-pack" to
fail when fetching a list of references that contains duplicates;
i.e., it insisted on the buggy behavior.  So change the test to expect
the correct behavior.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
382a967114 filter_refs(): do not check the same sought_pos twice
Once a match has been found at sought_pos, the entry is zeroed and no
future attempts will match that entry.  So increment sought_pos to
avoid checking against the zeroed-out entry during the next iteration.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
8bee93dd24 Change fetch_pack() and friends to take string_list arguments
Instead of juggling <nr_heads,heads> (sometimes called
<nr_match,match>), pass around the list of references to be sought in
a single string_list variable called "sought".  Future commits will
make more use of string_list functionality.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
63c694534b fetch_pack(): reindent function decl and defn
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
07c19e72c5 Rename static function fetch_pack() to http_fetch_pack()
Avoid confusion with the non-static function of the same name from
fetch-pack.h.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
8db43d2935 t5500: add tests of fetch-pack --all --depth=N $URL $REF
Document some bugs in "git fetch-pack":

1. If "git fetch-pack" is called with "--all", "--depth", and an
explicit existing non-tag reference to fetch, then it falsely reports
that the reference was not found, even though it was fetched
correctly.

2. If "git fetch-pack" is called with "--all", "--depth", and an
explicit existing tag reference to fetch, then it segfaults in
filter_refs() because return_refs is used without having been
initialized.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
3b0820045a t5500: add tests of error output for missing refs
If "git fetch-pack" is called with reference names that do not exist
on the remote, then it should emit an error message

    error: no such remote ref refs/heads/xyzzy

This is currently broken if *only* missing references are passed to
"git fetch-pack".

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty
51f3145c28 api-string-list.txt: initialize the string_list the easy way
In the demo code blurb, show how to initialize the string_list using
STRING_LIST_INIT_NODUP rather than memset().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:25 -07:00
Michael Haggerty
f103f95b11 string_list: add a function string_list_longest_prefix()
Add a function that finds the longest string from a string_list that
is a prefix of a given string.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:25 -07:00
Michael Haggerty
31d5451eed string_list: add a new function, string_list_remove_duplicates()
Add a function that deletes duplicate entries from a sorted
string_list.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:25 -07:00
Michael Haggerty
eb5f0c7a61 string_list: add a new function, filter_string_list()
This function allows entries that don't match a specified criterion to
be discarded from a string_list while preserving the order of the
remaining entries.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:25 -07:00
Michael Haggerty
ff919f965d string_list: add two new functions for splitting strings
Add two new functions, string_list_split() and
string_list_split_in_place().  These split a string into a string_list
on a separator character.  The first makes copies of the substrings
(leaving the input string untouched) and the second splits the
original string in place, overwriting the separator characters with
NULs and referring to the original string's memory.

These functions are similar to the strbuf_split_*() functions except
that they work with the more powerful string_list interface.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:24 -07:00
Michael Haggerty
e448fed8e6 string_list: add function string_list_append_nodup()
Add a new function that appends a string to a string_list without
copying it.  This can be used to pass ownership of an already-copied
string to a string_list that has strdup_strings set.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:24 -07:00
Junio C Hamano
0ce9864461 The fourth batch for 1.8.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-07 11:25:22 -07:00
Junio C Hamano
8023a42210 Merge branch 'nd/branch-v-alignment'
Output from "git branch -v" contains "(no branch)" that could be
localized, but the code to align it along with the names of branches
were counting in bytes, not in display columns.

* nd/branch-v-alignment:
  branch -v: align even when branch names are in UTF-8
2012-09-07 11:10:02 -07:00
Junio C Hamano
e6dd70e9bf Merge branch 'jk/maint-http-half-auth-push'
Pushing to smart HTTP server with recent Git fails without having
the username in the URL to force authentication, if the server is
configured to allow GET anonymously, while requiring authentication
for POST.

* jk/maint-http-half-auth-push:
  http: prompt for credentials on failed POST
  http: factor out http error code handling
  t: test http access to "half-auth" repositories
  t: test basic smart-http authentication
  t/lib-httpd: recognize */smart/* repos as smart-http
  t/lib-httpd: only route auth/dumb to dumb repos
  t5550: factor out http auth setup
  t5550: put auth-required repo in auth/dumb
2012-09-07 11:09:50 -07:00
Junio C Hamano
9192ece94b Merge branch 'jc/maint-doc-checkout-b-always-takes-branch-name'
The synopsis said "checkout [-B branch]" to make it clear the branch
name is a parameter to the option, but the heading for the option
description was "-B::", not "-B branch::", making the documentation
misleading.  There may be room in documentation pages of other
commands for similar improvements.

* jc/maint-doc-checkout-b-always-takes-branch-name:
  doc: "git checkout -b/-B/--orphan" always takes a branch name
2012-09-07 11:09:36 -07:00
Junio C Hamano
757bf26c85 Merge branch 'jc/apply-binary-p0'
"git apply -p0" did not parse pathnames on "diff --git" line
correctly.  This caused patches that had pathnames in no other
places to be mistakenly rejected (most notably, binary patch that
does not rename nor change mode).  Textual patches, renames or
mode changes have preimage and postimage pathnames in different
places in a form that can be parsed unambiguously and did not suffer
from this problem.

* jc/apply-binary-p0:
  apply: compute patch->def_name correctly under -p0
2012-09-07 11:09:26 -07:00
Junio C Hamano
7764a3b35c Merge branch 'jc/dotdot-is-parent-directory'
"git log .." errored out saying it is both rev range and a path when
there is no disambiguating "--" is on the command line.  Update the
command line parser to interpret ".." as a path in such a case.

* jc/dotdot-is-parent-directory:
  specifying ranges: we did not mean to make ".." an empty set
2012-09-07 11:09:18 -07:00
Junio C Hamano
096bbd6537 Merge branch 'nd/i18n-parseopt-help'
A lot of i18n mark-up for the help text from "git <cmd> -h".

* nd/i18n-parseopt-help: (66 commits)
  Use imperative form in help usage to describe an action
  Reduce translations by using same terminologies
  i18n: write-tree: mark parseopt strings for translation
  i18n: verify-tag: mark parseopt strings for translation
  i18n: verify-pack: mark parseopt strings for translation
  i18n: update-server-info: mark parseopt strings for translation
  i18n: update-ref: mark parseopt strings for translation
  i18n: update-index: mark parseopt strings for translation
  i18n: tag: mark parseopt strings for translation
  i18n: symbolic-ref: mark parseopt strings for translation
  i18n: show-ref: mark parseopt strings for translation
  i18n: show-branch: mark parseopt strings for translation
  i18n: shortlog: mark parseopt strings for translation
  i18n: rm: mark parseopt strings for translation
  i18n: revert, cherry-pick: mark parseopt strings for translation
  i18n: rev-parse: mark parseopt strings for translation
  i18n: reset: mark parseopt strings for translation
  i18n: rerere: mark parseopt strings for translation
  i18n: status: mark parseopt strings for translation
  i18n: replace: mark parseopt strings for translation
  ...
2012-09-07 11:09:09 -07:00
Junio C Hamano
e245397434 Merge branch 'nd/am-i18n-fix'
"git am" wasn't marked up for i18n properly.

* nd/am-i18n-fix:
  am: quote string for translation before passing to eval_gettextln
2012-09-07 11:09:04 -07:00
Junio C Hamano
7fe136d78f Merge branch 'jk/config-warn-on-inaccessible-paths'
When looking for $HOME/.gitconfig etc., it is OK if we cannot read
them because they do not exist, but we did not diagnose existing
files that we cannot read.

* jk/config-warn-on-inaccessible-paths:
  warn_on_inaccessible(): a helper to warn on inaccessible paths
  attr: warn on inaccessible attribute files
  gitignore: report access errors of exclude files
  config: warn on inaccessible files
2012-09-07 11:08:56 -07:00
Junio C Hamano
09827f2a55 Merge branch 'kk/maint-for-each-ref-multi-sort'
"git for-each-ref" did not currectly support more than one --sort
option.

* kk/maint-for-each-ref-multi-sort:
  for-each-ref: Fix sort with multiple keys
  t6300: test sort with multiple keys
2012-09-07 11:08:51 -07:00
Junio C Hamano
ae80b5a892 Merge branch 'lt/commit-tree-guess-utf-8'
Teach "git commit" and "git commit-tree" the "we are told to use
utf-8 in log message, but this does not look like utf-8---attempt to
pass it through convert-from-latin1-to-utf8 and see if it makes
sense" heuristics "git mailinfo" already uses.

* lt/commit-tree-guess-utf-8:
  commit/commit-tree: correct latin1 to utf-8
2012-09-07 11:08:38 -07:00
Junio C Hamano
7c88ec0576 Merge branch 'pw/p4-use-client-spec-branch-detection'
Fix "git p4" when "--use-client-spec" and "--detect-branches" are
used together (the command used to misdetect branches).

* pw/p4-use-client-spec-branch-detection:
  git p4: make branch detection work with --use-client-spec
  git p4: do wildcard decoding in stripRepoPath
  git p4: set self.branchPrefixes in initialization
  git p4 test: add broken --use-client-spec --detect-branches tests
  git p4 test: move client_view() function to library
2012-09-07 11:08:27 -07:00
Junio C Hamano
800981f40d Merge branch 'tr/maint-parseopt-avoid-empty'
A workaround to avoid doing _(""), which translates to unwanted
magic string in the .po files.

* tr/maint-parseopt-avoid-empty:
  gettext: do not translate empty string
2012-09-07 11:08:10 -07:00
Junio C Hamano
bdac578482 Merge branch 'nd/i18n-poison-test-updates'
Update tests that can be broken with gettext-poison builds.

* nd/i18n-poison-test-updates:
  Fix tests under GETTEXT_POISON on parseopt
  Fix tests under GETTEXT_POISON on git-remote
  Fix tests under GETTEXT_POISON on pack-object
  Fix tests under GETTEXT_POISON on git-apply
  Fix tests under GETTEXT_POISON on diffstat
  Fix tests under GETTEXT_POISON on git-stash
  Fix tests under GETTEXT_POISON on relative dates
2012-09-07 11:07:59 -07:00
Junio C Hamano
3fc0e4ca00 Update mailmap for a handful of folks
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-03 16:24:23 -07:00
Junio C Hamano
a2e78c2d87 The third batch for 1.8.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-03 16:23:44 -07:00
Junio C Hamano
ca23bd2bea Merge branch 'js/use-sc-open-max'
Introduce get_max_fd_limit() to absorb platforms that do not have
getrlimit(RLIMIT_NOFILE) and/or sysconf(_SC_OPEN_MAX).

* js/use-sc-open-max:
  sha1_file.c: introduce get_max_fd_limit() helper
2012-09-03 15:54:42 -07:00
Junio C Hamano
a795b324b7 Merge branch 'js/compat-mkdir'
Some mkdir(2) implementations do not want to see trailing slash in
its parameter.

* js/compat-mkdir:
  compat: some mkdir() do not like a slash at the end
2012-09-03 15:54:37 -07:00
Junio C Hamano
c1310be00c Merge branch 'js/no-curl-easy-strerror-on-old-curl'
Done to support compilation on __TANDEM, but is independently useful
for people with older version of libcURL.

* js/no-curl-easy-strerror-on-old-curl:
  http.c: don't use curl_easy_strerror prior to curl-7.12.0
2012-09-03 15:54:30 -07:00
Junio C Hamano
4052719f6d Merge branch 'jc/maint-mergetool-style-fix'
* jc/maint-mergetool-style-fix:
  mergetool: style fixes
2012-09-03 15:54:25 -07:00
Junio C Hamano
81dbbf7240 Merge branch 'sz/submodule-force-update'
"git submodule update --force" used to leave the working tree of the
submodule intact when there were local changes.  It is more intiutive
to make "--force" a sign to run "checkout -f" to overwrite them.

* sz/submodule-force-update:
  Make 'git submodule update --force' always check out submodules.
2012-09-03 15:54:18 -07:00
Junio C Hamano
799beac153 Merge branch 'ph/stash-rerere'
"git stash" internally used "git merge-recursive" backend, which did
not trigger "rerere" upon conflicts unlike other mergy operations.

* ph/stash-rerere:
  stash: invoke rerere in case of conflict
  test: git-stash conflict sets up rerere
2012-09-03 15:54:12 -07:00
Junio C Hamano
19801d6a27 Merge branch 'jc/daemon-access-hook'
Allow an external command to tell git-daemon to decline service
based on the client address, repository path, etc.

* jc/daemon-access-hook:
  daemon: --access-hook option
2012-09-03 15:54:03 -07:00
Junio C Hamano
200282f1c7 Merge branch 'jc/send-email-reconfirm'
Validate interactive input to "git send-email" to avoid common
mistakes such as saying "y<RETURN>" to sender mail address whose
prompt is given with a correctly guessed default.

* jc/send-email-reconfirm:
  send-email: validate & reconfirm interactive responses
2012-09-03 15:53:54 -07:00
Junio C Hamano
831287d37c Merge branch 'cw/cherry-pick-allow-empty-message'
"git cherry-pick" by default stops when it sees a commit without any
log message.  The "--allow-empty-message" option can be used to
silently proceed.

* cw/cherry-pick-allow-empty-message:
  cherry-pick: add --allow-empty-message option
2012-09-03 15:53:37 -07:00
Junio C Hamano
12d858aeb4 Merge branch 'jc/maint-sane-execvp-notdir'
"git foo" errored out with "Not a directory" when the user had a non
directory on $PATH, and worse yet it masked an alias "foo" to run.

* jc/maint-sane-execvp-notdir:
  sane_execvp(): ignore non-directory on $PATH
2012-09-03 15:53:26 -07:00
Junio C Hamano
3e06f5ff38 Merge branch 'jc/maint-config-exit-status'
The exit status code from "git config" was way overspecified while
being incorrect.  Update the implementation to give the documented
status for a case that was documented, and introduce a new code for
"all other errors".

* jc/maint-config-exit-status:
  config: "git config baa" should exit with status 1
2012-09-03 15:53:07 -07:00
Junio C Hamano
16d26b168b Latter half of the second batch for 1.8.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-29 15:00:30 -07:00