* Re: [PATCH] git-send-email: add ~/.authinfo parsing
From: Ted Zlatanov @ 2013-02-04 20:28 UTC (permalink / raw)
To: Jeff King; +Cc: Michal Nazarewicz, Junio C Hamano, git, Krzysztof Mazur
In-Reply-To: <20130204201040.GA13272@sigill.intra.peff.net>
On Mon, 4 Feb 2013 15:10:40 -0500 Jeff King <peff@peff.net> wrote:
JK> Technically you can speak a particular protocol on an alternate port:
JK> https://example.com:31337/repo.git
JK> In this case, git will send you the host as:
JK> example.com:31337
JK> You might want to map this to "port" in .autoinfo separately if it's
JK> available.
That would create the following possibilities:
* host example.com:31337, protocol https
* host example.com:31337, protocol unspecified
* host example.com, protocol https
* host example.com, protocol unspecified
How would you like each one to be handled? My preference would be to
make the user say "host example.com:31337" in the netrc file (the
current situation); that's what we do in Emacs and it lets applications
request credentials for a logical service no matter what the port is.
It means that example.com credentials won't be used for
example.com:31337. In practice, that has not been a problem for us.
Ted
^ permalink raw reply
* Re: [New Feature] git-submodule-move - Easily move submodules
From: Jens Lehmann @ 2013-02-04 20:14 UTC (permalink / raw)
To: TJ; +Cc: git, W. Trevor King
In-Reply-To: <510EE661.8060600@iam.tj>
Am 03.02.2013 23:36, schrieb TJ:
> I've recently had need to re-arrange more than ten submodules within a project and discovered there is apparently no easy way to do it.
>
> Using some suggestions I found on Stack Overflow I eventually figured out the steps required. Because the steps can be
> complex I thought it would be handy to have a tool to automate the functionality.
>
> I have put together a reasonably bullet-proof shell script "git-submodule-move" that does the job pretty well. I've put it through quite a bit of testing and trusted it with my own project and it has
> performed well.
>
> I've published to github so others can use and improve it.
>
> https://github.com/iam-TJ/git-submodule-move
I'd propose to drop these two steps:
updating super-repository's submodule name
moving super-repository's submodule repository
Changing the name makes the moved submodule a completely new entity and will
lead to a reclone of the repository as soon as recursive checkout materializes.
And Trevor already mentioned the long term solution which is to teach "git mv"
to do all that, which is next on my list.
^ permalink raw reply
* Re: [PATCH] git-send-email: add ~/.authinfo parsing
From: Jeff King @ 2013-02-04 20:10 UTC (permalink / raw)
To: Ted Zlatanov; +Cc: Michal Nazarewicz, Junio C Hamano, git, Krzysztof Mazur
In-Reply-To: <878v74vwst.fsf@lifelogs.com>
On Mon, Feb 04, 2013 at 12:00:34PM -0500, Ted Zlatanov wrote:
> On Mon, 04 Feb 2013 17:33:58 +0100 Michal Nazarewicz <mina86@mina86.com> wrote:
>
> MN> As far as I understand, there could be a git-credential helper that
> MN> reads ~/.authinfo and than git-send-email would just call “git
> MN> credential fill”, right?
>
> MN> I've noticed though, that git-credential does not support port argument,
> MN> which makes it slightly incompatible with ~/.authinfo.
>
> My proposed netrc credential helper does this :)
>
> The token mapping I use:
>
> port, protocol => protocol
> machine, host => host
> path => path
> login, username, user => username
> password => password
>
> I think that's sensible.
Technically you can speak a particular protocol on an alternate port:
https://example.com:31337/repo.git
In this case, git will send you the host as:
example.com:31337
You might want to map this to "port" in .autoinfo separately if it's
available.
-Peff
^ permalink raw reply
* [PATCH v3] submodule: add 'deinit' command
From: Jens Lehmann @ 2013-02-04 20:09 UTC (permalink / raw)
To: Git Mailing List
Cc: Junio C Hamano, Heiko Voigt, Michael J Gruber, Phil Hord,
Marc Branchaud, W. Trevor King
With "git submodule init" the user is able to tell git he cares about one
or more submodules and wants to have it populated on the next call to "git
submodule update". But currently there is no easy way he could tell git he
does not care about a submodule anymore and wants to get rid of his local
work tree (except he knows a lot about submodule internals and removes the
"submodule.$name.url" setting from .git/config together with the work tree
himself).
Help those users by providing a 'deinit' command. This removes the whole
submodule.<name> section from .git/config either for the given
submodule(s) (or for all those which have been initialized if '.' is
given). Fail if the current work tree contains modifications unless
forced. Complain when for a submodule given on the command line the url
setting can't be found in .git/config, but nonetheless don't fail.
Add tests and link the man pages of "git submodule deinit" and "git rm"
to assist the user in deciding whether removing or unregistering the
submodule is the right thing to do for him.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
Ok, here is the reroll following the discussion in $gmane/212884.
Changes since v2 are:
- deinit always needs an argument; if the user wants to deinit all initialized
submodules he can use "." (and we tell him that when failing without any
arguments).
- We also remove the work tree of the submodule. When it contains local changes
(tested with "git rm -n") this fails unless forced.
Documentation/git-rm.txt | 4 +++
Documentation/git-submodule.txt | 18 ++++++++++-
git-submodule.sh | 70 ++++++++++++++++++++++++++++++++++++++++-
t/t7400-submodule-basic.sh | 24 ++++++++++++++
4 files changed, 114 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index 262436b..8ae72f7 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -149,6 +149,10 @@ files that aren't ignored are present in the submodules work tree.
Ignored files are deemed expendable and won't stop a submodule's work
tree from being removed.
+If you only want to remove the local checkout of a submodule from your
+work tree without committing that use linkgit:git-submodule[1] `deinit`
+instead.
+
EXAMPLES
--------
`git rm Documentation/\*.txt`::
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index b1996f1..9a20e1d 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -13,6 +13,7 @@ SYNOPSIS
[--reference <repository>] [--] <repository> [<path>]
'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
'git submodule' [--quiet] init [--] [<path>...]
+'git submodule' [--quiet] deinit [-f|--force] [--] <path>...
'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch] [--rebase]
[--reference <repository>] [--merge] [--recursive] [--] [<path>...]
'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]
@@ -134,6 +135,19 @@ init::
the explicit 'init' step if you do not intend to customize
any submodule locations.
+deinit::
+ Unregister the given submodules, i.e. remove the whole
+ `submodule.$name` section from .git/config together with their work
+ tree. Further calls to `git submodule update`, `git submodule foreach`
+ and `git submodule sync` will skip any unregistered submodules until
+ they are initialized again, so use this command if you don't want to
+ have a local checkout of the submodule in your work tree anymore. If
+ you really want to remove a submodule from the repository and commit
+ that use linkgit:git-rm[1] instead.
++
+If `--force` is specified, the submodule's work tree will be removed even if
+it contains local modifications.
+
update::
Update the registered submodules, i.e. clone missing submodules and
checkout the commit specified in the index of the containing repository.
@@ -213,8 +227,10 @@ OPTIONS
-f::
--force::
- This option is only valid for add and update commands.
+ This option is only valid for add, deinit and update commands.
When running add, allow adding an otherwise ignored submodule path.
+ When running deinit the submodule work trees will be removed even if
+ they contain local changes.
When running update, throw away local changes in submodules when
switching to a different commit; and always run a checkout operation
in the submodule, even if the commit listed in the index of the
diff --git a/git-submodule.sh b/git-submodule.sh
index 22ec5b6..e01f6b5 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -8,6 +8,7 @@ dashless=$(basename "$0" | sed -e 's/-/ /')
USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: $dashless [--quiet] init [--] [<path>...]
+ or: $dashless [--quiet] deinit [-f|--force] [--] <path>...
or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
or: $dashless [--quiet] foreach [--recursive] <command>
@@ -547,6 +548,73 @@ cmd_init()
}
#
+# Unregister submodules from .git/config and remove their work tree
+#
+# $@ = requested paths (use '.' to deinit all submodules)
+#
+cmd_deinit()
+{
+ # parse $args after "submodule ... init".
+ while test $# -ne 0
+ do
+ case "$1" in
+ -f|--force)
+ force=$1
+ ;;
+ -q|--quiet)
+ GIT_QUIET=1
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ usage
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if test "$#" == "0"
+ then
+ die "$(eval_gettext "Use '.' if you really want to deinitialize all submodules")"
+ fi
+
+ module_list "$@" |
+ while read mode sha1 stage sm_path
+ do
+ die_if_unmatched "$mode"
+ name=$(module_name "$sm_path") || exit
+ url=$(git config submodule."$name".url)
+ if test -z "$url"
+ then
+ # Only mention uninitialized submodules when its
+ # path have been specified
+ test "$@" != "." &&
+ say "$(eval_gettext "No url found for submodule path '\$sm_path' in .git/config")"
+ continue
+ fi
+
+ # Remove the submodule work tree
+ if test -z $force
+ then
+ git rm -n "$sm_path" ||
+ die "$(eval_gettext "Submodule work tree $sm_path contains local modifications, use '-f' to discard them")"
+ fi
+ rm -rf "$sm_path"
+ mkdir "$sm_path"
+
+ # Remove the whole section so we have a clean state when the
+ # user later decides to init this submodule again
+ git config --remove-section submodule."$name" &&
+ say "$(eval_gettext "Submodule '\$name' (\$url) unregistered for path '\$sm_path'")"
+ done
+}
+
+#
# Update each submodule path to correct revision, using clone and checkout as needed
#
# $@ = requested paths (default to all)
@@ -1157,7 +1225,7 @@ cmd_sync()
while test $# != 0 && test -z "$command"
do
case "$1" in
- add | foreach | init | update | status | summary | sync)
+ add | foreach | init | deinit | update | status | summary | sync)
command=$1
;;
-q|--quiet)
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 2683cba..34d8274 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -757,4 +757,28 @@ test_expect_success 'submodule add with an existing name fails unless forced' '
)
'
+test_expect_success 'submodule deinit should remove the whole submodule section from .git/config' '
+ git config submodule.example.foo bar &&
+ git submodule deinit init &&
+ test -z "$(git config submodule.example.url)" &&
+ test -z "$(git config submodule.example.foo)"
+'
+
+test_expect_success 'submodule deinit . deinits all initialized submodules' '
+ git submodule update --init &&
+ git config submodule.example.foo bar &&
+ test_must_fail git submodule deinit &&
+ git submodule deinit . &&
+ test -z "$(git config submodule.example.url)" &&
+ test -z "$(git config submodule.example.foo)"
+'
+
+test_expect_success 'submodule deinit complains when explicitly used on an uninitialized submodule' '
+ git submodule update --init &&
+ git submodule deinit init >actual &&
+ test_i18ngrep "Submodule .example. (.*) unregistered for path .init" actual
+ git submodule deinit init >actual &&
+ test_i18ngrep "No url found for submodule path .init. in .git/config" actual
+'
+
test_done
--
1.8.1.2.460.gae7a4e0
^ permalink raw reply related
* What's cooking in git.git (Feb 2013, #02; Mon, 4)
From: Junio C Hamano @ 2013-02-04 20:08 UTC (permalink / raw)
To: git
Here are the topics that have been cooking. Commits prefixed with
'-' are only in 'pu' (proposed updates) while commits prefixed with
'+' are in 'next'.
As usual, this cycle is expected to last for 8 to 10 weeks, with a
preview -rc0 sometime in the middle of this month.
You can find the changes described here in the integration branches of the
repositories listed at
http://git-blame.blogspot.com/p/git-public-repositories.html
--------------------------------------------------
[Graduated to "master"]
* jc/custom-comment-char (2013-01-16) 1 commit
(merged to 'next' on 2013-01-25 at 91d8a5d)
+ Allow custom "comment char"
Allow a configuration variable core.commentchar to customize the
character used to comment out the hint lines in the edited text
from the default '#'.
This is half my work and half by Ralf Thielow. There may still be
leftover '#' lurking around, though. My "git grep" says C code
should be already fine, but git-rebase--interactive.sh could be
converted (it should not matter, as the file is not really a
free-form text).
* jc/push-reject-reasons (2013-01-24) 4 commits
(merged to 'next' on 2013-01-28 at b60be93)
+ push: finishing touches to explain REJECT_ALREADY_EXISTS better
+ push: introduce REJECT_FETCH_FIRST and REJECT_NEEDS_FORCE
+ push: further simplify the logic to assign rejection reason
+ push: further clean up fields of "struct ref"
Improve error and advice messages given locally when "git push"
refuses when it cannot compute fast-forwardness by separating these
cases from the normal "not a fast-forward; merge first and push
again" case.
* jk/config-parsing-cleanup (2013-01-23) 8 commits
(merged to 'next' on 2013-01-28 at 9bc9411)
+ reflog: use parse_config_key in config callback
+ help: use parse_config_key for man config
+ submodule: simplify memory handling in config parsing
+ submodule: use parse_config_key when parsing config
+ userdiff: drop parse_driver function
+ convert some config callbacks to parse_config_key
+ archive-tar: use parse_config_key when parsing config
+ config: add helper function for parsing key names
Configuration parsing for tar.* configuration variables were
broken. Introduce a new config-keyname parser API to make the
callers much less error prone.
* jk/read-commit-buffer-data-after-free (2013-01-26) 3 commits
(merged to 'next' on 2013-01-30 at c6d7e16)
+ logmsg_reencode: lazily load missing commit buffers
+ logmsg_reencode: never return NULL
+ commit: drop useless xstrdup of commit message
Clarify the ownership rule for commit->buffer field, which some
callers incorrectly accessed without making sure it is populated.
* jk/remote-helpers-in-python-3 (2013-01-30) 10 commits
(merged to 'next' on 2013-01-31 at 5a948aa)
+ git_remote_helpers: remove GIT-PYTHON-VERSION upon "clean"
(merged to 'next' on 2013-01-28 at d898471)
+ git-remote-testpy: fix path hashing on Python 3
(merged to 'next' on 2013-01-25 at acf9419)
+ git-remote-testpy: call print as a function
+ git-remote-testpy: don't do unbuffered text I/O
+ git-remote-testpy: hash bytes explicitly
+ svn-fe: allow svnrdump_sim.py to run with Python 3
+ git_remote_helpers: use 2to3 if building with Python 3
+ git_remote_helpers: force rebuild if python version changes
+ git_remote_helpers: fix input when running under Python 3
+ git_remote_helpers: allow building with Python 3
Prepare remote-helper test written in Python to be run with Python3.
* mm/add-u-A-sans-pathspec (2013-01-28) 1 commit
(merged to 'next' on 2013-01-28 at fe762a6)
+ add: warn when -u or -A is used without pathspec
Forbid "git add -u" and "git add -A" without pathspec run from a
subdirectory, to train people to type "." (or ":/") to make the
choice of default does not matter.
* pw/git-p4-on-cygwin (2013-01-26) 21 commits
(merged to 'next' on 2013-01-30 at 958ae3a)
+ git p4: introduce gitConfigBool
+ git p4: avoid shell when calling git config
+ git p4: avoid shell when invoking git config --get-all
+ git p4: avoid shell when invoking git rev-list
+ git p4: avoid shell when mapping users
+ git p4: disable read-only attribute before deleting
+ git p4 test: use test_chmod for cygwin
+ git p4: cygwin p4 client does not mark read-only
+ git p4 test: avoid wildcard * in windows
+ git p4 test: use LineEnd unix in windows tests too
+ git p4 test: newline handling
+ git p4: scrub crlf for utf16 files on windows
+ git p4: remove unreachable windows \r\n conversion code
+ git p4 test: translate windows paths for cygwin
+ git p4 test: start p4d inside its db dir
+ git p4 test: use client_view in t9806
+ git p4 test: avoid loop in client_view
+ git p4 test: use client_view to build the initial client
+ git p4: generate better error message for bad depot path
+ git p4: remove unused imports
+ git p4: temp branch name should use / even on windows
Improve "git p4" on Cygwin.
--------------------------------------------------
[New Topics]
* jn/auto-depend-workaround-buggy-ccache (2013-02-01) 1 commit
(merged to 'next' on 2013-02-02 at db5940a)
+ Makefile: explicitly set target name for autogenerated dependencies
An age-old workaround to prevent buggy versions of ccache from
breaking the auto-generation of dependencies, which unfortunately
is still relevant because some people use ancient distros.
Will merge to 'master'.
* ct/autoconf-htmldir (2013-02-02) 1 commit
- Honor configure's htmldir switch
The autoconf subsystem passed --mandir down to generated
config.mak.autogen but forgot to do the same for --htmldir.
Will merge to 'next'.
* mk/tcsh-complete-only-known-paths (2013-02-03) 1 commit
- completion: handle path completion and colon for tcsh script
(this branch uses mp/complete-paths.)
Manlio's "complete with known paths only" update to completion
scripts returns directory names without trailing slash to
compensate the addition of '/' done by bash that reads from our
completion result. tcsh completion code that reads from our
internal completion result does not add '/', so let it ask our
complletion code to keep the '/' at the end.
Will merge to 'next'.
* jc/combine-diff-many-parents (2013-02-03) 1 commit
- combine-diff: lift 32-way limit of combined diff
We used to have an arbitrary 32 limit for combined diff input,
resulting in incorrect number of leading colons shown when showing
the "--raw --cc" output.
May want a couple of new tests.
* jc/remove-export-from-config-mak-in (2013-02-03) 1 commit
- config.mak.in: remove unused definitions
config.mak.in template had an "export" line to cause a few
common makefile variables to be exported; if they need to be
expoted for autoconf/configure users, they should also be exported
for people who write config.mak the same way. Move the "export" to
the main Makefile.
* jk/apply-similaritly-parsing (2013-02-03) 1 commit
- builtin/apply: tighten (dis)similarity index parsing
Make sure the similarity value shown in the "apply --summary"
output is sensible, even when the input had a bogus value.
Will merge to 'next'.
* nd/status-show-in-progress (2013-02-03) 1 commit
- status: show the branch name if possible in in-progress info
--------------------------------------------------
[Stalled]
* dg/subtree-fixes (2013-01-08) 7 commits
- contrib/subtree: mkdir the manual directory if needed
- contrib/subtree: honor $(DESTDIR)
- contrib/subtree: fix synopsis and command help
- contrib/subtree: better error handling for "add"
- contrib/subtree: add --unannotate option
- contrib/subtree: use %B for split Subject/Body
- t7900: remove test number comments
contrib/subtree updates; there are a few more from T. Zheng that
were posted separately, with an overlap.
Expecting a reroll.
* mp/diff-algo-config (2013-01-16) 3 commits
- diff: Introduce --diff-algorithm command line option
- config: Introduce diff.algorithm variable
- git-completion.bash: Autocomplete --minimal and --histogram for git-diff
Add diff.algorithm configuration so that the user does not type
"diff --histogram".
Looking better; may want tests to protect it from future breakages,
but otherwise it looks ready for 'next'.
Expecting a follow-up to add tests.
* mb/gitweb-highlight-link-target (2012-12-20) 1 commit
- Highlight the link target line in Gitweb using CSS
Expecting a reroll.
$gmane/211935
* jl/submodule-deinit (2012-12-04) 1 commit
- submodule: add 'deinit' command
There was no Porcelain way to say "I no longer am interested in
this submodule", once you express your interest in a submodule with
"submodule init". "submodule deinit" is the way to do so.
Expecting a reroll.
$gmane/212884
* jk/lua-hackery (2012-10-07) 6 commits
- pretty: fix up one-off format_commit_message calls
- Minimum compilation fixup
- Makefile: make "lua" a bit more configurable
- add a "lua" pretty format
- add basic lua infrastructure
- pretty: make some commit-parsing helpers more public
Interesting exercise. When we do this for real, we probably would want
to wrap a commit to make it more like an "object" with methods like
"parents", etc.
* rc/maint-complete-git-p4 (2012-09-24) 1 commit
- Teach git-completion about git p4
Comment from Pete will need to be addressed ($gmane/206172).
* jc/maint-name-rev (2012-09-17) 7 commits
- describe --contains: use "name-rev --algorithm=weight"
- name-rev --algorithm=weight: tests and documentation
- name-rev --algorithm=weight: cache the computed weight in notes
- name-rev --algorithm=weight: trivial optimization
- name-rev: --algorithm option
- name_rev: clarify the logic to assign a new tip-name to a commit
- name-rev: lose unnecessary typedef
"git name-rev" names the given revision based on a ref that can be
reached in the smallest number of steps from the rev, but that is
not useful when the caller wants to know which tag is the oldest one
that contains the rev. This teaches a new mode to the command that
uses the oldest ref among those which contain the rev.
I am not sure if this is worth it; for one thing, even with the help
from notes-cache, it seems to make the "describe --contains" even
slower. Also the command will be unusably slow for a user who does
not have a write access (hence unable to create or update the
notes-cache).
Stalled mostly due to lack of responses.
* jc/xprm-generation (2012-09-14) 1 commit
- test-generation: compute generation numbers and clock skews
A toy to analyze how bad the clock skews are in histories of real
world projects.
Stalled mostly due to lack of responses.
* jc/add-delete-default (2012-08-13) 1 commit
- git add: notice removal of tracked paths by default
"git add dir/" updated modified files and added new files, but does
not notice removed files, which may be "Huh?" to some users. They
can of course use "git add -A dir/", but why should they?
Resurrected from graveyard, as I thought it was a worthwhile thing
to do in the longer term.
Stalled mostly due to lack of responses.
* mb/remote-default-nn-origin (2012-07-11) 6 commits
- Teach get_default_remote to respect remote.default.
- Test that plain "git fetch" uses remote.default when on a detached HEAD.
- Teach clone to set remote.default.
- Teach "git remote" about remote.default.
- Teach remote.c about the remote.default configuration setting.
- Rename remote.c's default_remote_name static variables.
When the user does not specify what remote to interact with, we
often attempt to use 'origin'. This can now be customized via a
configuration variable.
Expecting a reroll.
$gmane/210151
"The first remote becomes the default" bit is better done as a
separate step.
* nd/parse-pathspec (2013-01-11) 20 commits
. Convert more init_pathspec() to parse_pathspec()
. Convert add_files_to_cache to take struct pathspec
. Convert {read,fill}_directory to take struct pathspec
. Convert refresh_index to take struct pathspec
. Convert report_path_error to take struct pathspec
. checkout: convert read_tree_some to take struct pathspec
. Convert unmerge_cache to take struct pathspec
. Convert read_cache_preload() to take struct pathspec
. add: convert to use parse_pathspec
. archive: convert to use parse_pathspec
. ls-files: convert to use parse_pathspec
. rm: convert to use parse_pathspec
. checkout: convert to use parse_pathspec
. rerere: convert to use parse_pathspec
. status: convert to use parse_pathspec
. commit: convert to use parse_pathspec
. clean: convert to use parse_pathspec
. Export parse_pathspec() and convert some get_pathspec() calls
. Add parse_pathspec() that converts cmdline args to struct pathspec
. pathspec: save the non-wildcard length part
Uses the parsed pathspec structure in more places where we used to
use the raw "array of strings" pathspec.
Ejected from 'pu' for now; will take a look at the rerolled one
later ($gmane/213340).
--------------------------------------------------
[Cooking]
* ft/transport-report-segv (2013-01-31) 1 commit
(merged to 'next' on 2013-02-02 at 6c450a7)
+ push: fix segfault when HEAD points nowhere
A failure to push due to non-ff while on an unborn branch
dereferenced a NULL pointer when showing an error message.
Will merge to 'master'.
* sb/gpg-i18n (2013-01-31) 1 commit
(merged to 'next' on 2013-02-02 at 7a54574)
+ gpg: allow translation of more error messages
Will merge to 'master'.
* sb/gpg-plug-fd-leak (2013-01-31) 1 commit
(merged to 'next' on 2013-02-02 at c271a31)
+ gpg: close stderr once finished with it in verify_signed_buffer()
We forgot to close the file descriptor reading from "gpg" output,
killing "git log --show-signature" on a long history.
Will merge to 'master'.
* sb/run-command-fd-error-reporting (2013-02-01) 1 commit
(merged to 'next' on 2013-02-02 at be7e970)
+ run-command: be more informative about what failed
Will merge to 'master'.
* jk/remote-helpers-doc (2013-02-01) 1 commit
(merged to 'next' on 2013-02-02 at ce1461a)
+ Rename {git- => git}remote-helpers.txt
"git help remote-helpers" did not work; 'remote-helpers' is not
a subcommand name but a concept, so its documentation should have
been in gitremote-helpers, not git-remote-helpers.
Will merge to 'master'.
* sp/smart-http-content-type-check (2013-02-04) 1 commit
(merged to 'next' on 2013-02-04 at d0759cb)
+ Verify Content-Type from smart HTTP servers
The smart HTTP clients forgot to verify the content-type that comes
back from the server side to make sure that the request is being
handled properly.
Will merge to 'master'.
* jc/mention-tracking-for-pull-default (2013-01-31) 1 commit
- doc: mention tracking for pull.default
We stopped mentioning `tracking` is a deprecated but supported
synonym for `upstream` in pull.default even though we have no
intention of removing the support for it.
This is my "don't list it to catch readers' eyes, but make sure it
can be found if the reader looks for it" version; I'm not married
to the layout and am willing to take a replacement patch.
* jc/fake-ancestor-with-non-blobs (2013-01-31) 3 commits
(merged to 'next' on 2013-02-02 at 86d457a)
+ apply: diagnose incomplete submodule object name better
+ apply: simplify build_fake_ancestor()
+ git-am: record full index line in the patch used while rebasing
Rebasing the history of superproject with change in the submodule
has been broken since v1.7.12.
Will merge to 'master'.
* jk/doc-makefile-cleanup (2013-02-01) 1 commit
(merged to 'next' on 2013-02-02 at 86ff373)
+ Documentation/Makefile: clean up MAN*_TXT lists
Will merge to 'master'.
* ab/gitweb-use-same-scheme (2013-01-28) 1 commit
(merged to 'next' on 2013-02-02 at 7e4a108)
+ gitweb: refer to picon/gravatar images over the same scheme
Avoid mixed contents on a page coming via http and https when
gitweb is hosted on a https server.
Will merge to 'master'.
* jk/python-styles (2013-01-30) 1 commit
(merged to 'next' on 2013-02-02 at 293edc1)
+ CodingGuidelines: add Python coding guidelines
Will merge to 'master'.
* mn/send-email-authinfo (2013-01-29) 1 commit
- git-send-email: add ~/.authinfo parsing
Expecting a reroll.
$gmane/215004, $gmane/215024.
* mp/complete-paths (2013-01-11) 1 commit
(merged to 'next' on 2013-01-30 at 70e4f1a)
+ git-completion.bash: add support for path completion
(this branch is used by mk/tcsh-complete-only-known-paths.)
The completion script used to let the default completer to suggest
pathnames, which gave too many irrelevant choices (e.g. "git add"
would not want to add an unmodified path). Teach it to use a more
git-aware logic to enumerate only relevant ones.
This is logically the right thing to do, and we would really love
to see people who have been involved in completion code to review
and comment on the implementation.
Will cook in 'next' to see if anybody screams.
* ss/mergetools-tortoise (2013-02-01) 2 commits
(merged to 'next' on 2013-02-03 at d306b83)
+ mergetools: teach tortoisemerge to handle filenames with SP correctly
+ mergetools: support TortoiseGitMerge
Update mergetools to work better with newer merge helper tortoise ships.
Will merge to 'master'.
* da/mergetool-docs (2013-02-02) 5 commits
(merged to 'next' on 2013-02-03 at f822dcf)
+ doc: generate a list of valid merge tools
+ mergetool--lib: list user configured tools in '--tool-help'
+ mergetool--lib: add functions for finding available tools
+ mergetool--lib: improve the help text in guess_merge_tool()
+ mergetool--lib: simplify command expressions
(this branch uses jk/mergetool.)
Build on top of the clean-up done by jk/mergetool and automatically
generate the list of mergetool and difftool backends the build
supports to be included in the documentation.
Will merge to 'master'.
* nd/branch-error-cases (2013-01-31) 6 commits
(merged to 'next' on 2013-02-02 at cf5e745)
+ branch: let branch filters imply --list
+ docs: clarify git-branch --list behavior
+ branch: mark more strings for translation
+ Merge branch 'nd/edit-branch-desc-while-detached' into HEAD
+ branch: give a more helpful message on redundant arguments
+ branch: reject -D/-d without branch name
Fix various error messages and conditions in "git branch", e.g. we
advertised "branch -d/-D" to remove one or more branches but actually
implemented removal of zero or more branches---request to remove no
branches was not rejected.
Will merge to 'master'.
* jk/mergetool (2013-01-28) 8 commits
(merged to 'next' on 2013-02-03 at 2ff5dee)
+ mergetools: simplify how we handle "vim" and "defaults"
+ mergetool--lib: don't call "exit" in setup_tool
+ mergetool--lib: improve show_tool_help() output
+ mergetools/vim: remove redundant diff command
+ git-difftool: use git-mergetool--lib for "--tool-help"
+ git-mergetool: don't hardcode 'mergetool' in show_tool_help
+ git-mergetool: remove redundant assignment
+ git-mergetool: move show_tool_help to mergetool--lib
(this branch is used by da/mergetool-docs.)
Cleans up mergetool/difftool combo.
Will merge to 'master'.
* jc/hidden-refs (2013-01-30) 8 commits
- WIP: receive.allowupdatestohidden
- fetch: fetch objects by their exact SHA-1 object names
- upload-pack: optionally allow fetching from the tips of hidden refs
- fetch: use struct ref to represent refs to be fetched
- parse_fetch_refspec(): clarify the codeflow a bit
- upload/receive-pack: allow hiding ref hierarchies
- upload-pack: simplify request validation
- upload-pack: share more code
Allow the server side to unclutter the refs/ namespace it shows to
the client. Optionally allow requests for histories leading to the
tips of hidden refs by updated clients.
Will merge to 'next' after dropping the tip.
* ta/doc-no-small-caps (2013-02-01) 6 commits
(merged to 'next' on 2013-02-02 at 77cbd0e)
+ Documentation: StGit is the right spelling, not StGIT
+ Documentation: describe the "repository" in repository-layout
+ Documentation: add a description for 'gitfile' to glossary
+ Documentation: do not use undefined terms git-dir and git-file
+ Documentation: the name of the system is 'Git', not 'git'
+ Documentation: avoid poor-man's small caps GIT
Update documentation to change "GIT" which was a poor-man's small
caps to "Git". The latter was the intended spelling.
Also change "git" spelled in all-lowercase to "Git" when it refers
to the system as the whole or the concept it embodies, as opposed to
the command the end users would type.
Will merge to 'master'.
* jc/remove-treesame-parent-in-simplify-merges (2013-01-17) 1 commit
(merged to 'next' on 2013-01-30 at b639b47)
+ simplify-merges: drop merge from irrelevant side branch
The --simplify-merges logic did not cull irrelevant parents from a
merge that is otherwise not interesting with respect to the paths
we are following.
This touches a fairly core part of the revision traversal
infrastructure; even though I think this change is correct, please
report immediately if you find any unintended side effect.
Will cook in 'next'.
* jc/push-2.0-default-to-simple (2013-01-16) 14 commits
(merged to 'next' on 2013-01-16 at 23f5df2)
+ t5570: do not assume the "matching" push is the default
+ t5551: do not assume the "matching" push is the default
+ t5550: do not assume the "matching" push is the default
(merged to 'next' on 2013-01-09 at 74c3498)
+ doc: push.default is no longer "matching"
+ push: switch default from "matching" to "simple"
+ t9401: do not assume the "matching" push is the default
+ t9400: do not assume the "matching" push is the default
+ t7406: do not assume the "matching" push is the default
+ t5531: do not assume the "matching" push is the default
+ t5519: do not assume the "matching" push is the default
+ t5517: do not assume the "matching" push is the default
+ t5516: do not assume the "matching" push is the default
+ t5505: do not assume the "matching" push is the default
+ t5404: do not assume the "matching" push is the default
Will cook in 'next' until Git 2.0 ;-).
* bc/append-signed-off-by (2013-01-27) 11 commits
- Unify appending signoff in format-patch, commit and sequencer
- format-patch: update append_signoff prototype
- t4014: more tests about appending s-o-b lines
- sequencer.c: teach append_signoff to avoid adding a duplicate newline
- sequencer.c: teach append_signoff how to detect duplicate s-o-b
- sequencer.c: always separate "(cherry picked from" from commit body
- sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footer
- t/t3511: add some tests of 'cherry-pick -s' functionality
- t/test-lib-functions.sh: allow to specify the tag name to test_commit
- commit, cherry-pick -s: remove broken support for multiline rfc2822 fields
- sequencer.c: rework search for start of footer to improve clarity
Waiting for the final round of reroll before merging to 'next'.
After that we will go incremental.
^ permalink raw reply
* [PATCH] Add contrib/credentials/netrc with GPG support
From: Ted Zlatanov @ 2013-02-04 19:54 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King
Signed-off-by: Ted Zlatanov <tzz@lifelogs.com>
---
contrib/credential/netrc/git-credential-netrc | 223 +++++++++++++++++++++++++
1 files changed, 223 insertions(+), 0 deletions(-)
create mode 100755 contrib/credential/netrc/git-credential-netrc
diff --git a/contrib/credential/netrc/git-credential-netrc b/contrib/credential/netrc/git-credential-netrc
new file mode 100755
index 0000000..7b43aa9
--- /dev/null
+++ b/contrib/credential/netrc/git-credential-netrc
@@ -0,0 +1,223 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Getopt::Long;
+use File::Basename;
+
+my $VERSION = "0.1";
+
+my %options = (
+ help => 0,
+ debug => 0,
+
+ # identical token maps, e.g. host -> host, will be inserted later
+ tmap => {
+ port => 'protocol',
+ machine => 'host',
+ path => 'path',
+ login => 'username',
+ user => 'username',
+ password => 'password',
+ }
+ );
+
+# map each credential protocol token to itself on the netrc side
+$options{tmap}->{$_} = $_ foreach my $v (values %{$options{tmap}});
+
+foreach my $suffix ('.gpg', '') {
+ foreach my $base (qw/authinfo netrc/) {
+ my $file = glob("~/.$base$suffix");
+ next unless (defined $file && -f $file);
+ $options{file} = $file ;
+ }
+}
+
+Getopt::Long::Configure("bundling");
+
+# TODO: maybe allow the token map $options{tmap} to be configurable.
+GetOptions(\%options,
+ "help|h",
+ "debug|d",
+ "file|f=s",
+ );
+
+if ($options{help}) {
+ my $shortname = basename($0);
+ $shortname =~ s/git-credential-//;
+
+ print <<EOHIPPUS;
+
+$0 [-f AUTHFILE] [-d] get
+
+Version $VERSION by tzz\@lifelogs.com. License: BSD.
+
+Options:
+ -f AUTHFILE: specify a netrc-style file
+ -d: turn on debugging
+
+To enable (note that Git will prepend "git-credential-" to the helper
+name and look for it in the path):
+
+ git config credential.helper '$shortname -f AUTHFILE'
+
+And if you want lots of debugging info:
+
+ git config credential.helper '$shortname -f AUTHFILE -d'
+
+Only "get" mode is supported by this credential helper. It opens
+AUTHFILE and looks for entries that match the requested search
+criteria:
+
+ 'port|protocol':
+ The protocol that will be used (e.g., https). (protocol=X)
+
+ 'machine|host':
+ The remote hostname for a network credential. (host=X)
+
+ 'path':
+ The path with which the credential will be used. (path=X)
+
+ 'login|user|username':
+ The credential’s username, if we already have one. (username=X)
+
+Thus, when we get "protocol=https\nusername=tzz", this credential
+helper will look for lines in AUTHFILE that match
+
+port https login tzz
+
+OR
+
+protocol https login tzz
+
+OR... etc. acceptable tokens as listed above. Any unknown tokens are
+simply ignored.
+
+Then, the helper will print out whatever tokens it got from the line,
+including "password" tokens, mapping e.g. "port" back to "protocol".
+
+The first matching line is used. Tokens can be quoted as 'STRING' or
+"STRING".
+
+No caching is performed by this credential helper.
+
+EOHIPPUS
+
+ exit;
+}
+
+my $mode = shift @ARGV;
+
+# credentials may get 'get', 'store', or 'erase' as parameters but
+# only acknowledge 'get'
+die "Syntax: $0 [-f AUTHFILE] [-d] get" unless defined $mode;
+
+# only support 'get' mode
+exit unless $mode eq 'get';
+
+my $debug = $options{debug};
+my $file = $options{file};
+
+die "Sorry, you need to specify an existing netrc file (with or without a .gpg extension) with -f AUTHFILE"
+ unless defined $file;
+
+unless (-f $file) {
+ print STDERR "Sorry, the specified netrc $file is not accessible\n" if $debug;
+ exit 0;
+}
+
+my @data;
+if ($file =~ m/\.gpg$/) {
+ @data = load('-|', qw(gpg --decrypt), $file)
+}
+else {
+ @data = load('<', $file);
+}
+
+chomp @data;
+
+unless (scalar @data) {
+ print STDERR "Sorry, we could not load data from [$file]\n" if $debug;
+ exit;
+}
+
+# the query: start with every token with no value
+my %q = map { $_ => undef } values(%{$options{tmap}});
+
+while (<STDIN>) {
+ next unless m/([^=]+)=(.+)/;
+
+ my ($token, $value) = ($1, $2);
+ die "Unknown search token $1" unless exists $q{$token};
+ $q{$token} = $value;
+}
+
+# build reverse token map
+my %rmap;
+foreach my $k (keys %{$options{tmap}}) {
+ push @{$rmap{$options{tmap}->{$k}}}, $k;
+}
+
+# there are CPAN modules to do this better, but we want to avoid
+# dependencies and generally, complex netrc-style files are rare
+
+if ($debug) {
+ printf STDERR "searching for %s = %s\n", $_, $q{$_} || '(any value)'
+ foreach sort keys %q;
+}
+
+LINE: foreach my $line (@data) {
+
+ print STDERR "line [$line]\n" if $debug;
+ my @tok;
+ # gratefully stolen from Net::Netrc
+ while (length $line &&
+ $line =~ s/^("((?:[^"]+|\\.)*)"|((?:[^\\\s]+|\\.)*))\s*//) {
+ (my $tok = $+) =~ s/\\(.)/$1/g;
+ push(@tok, $tok);
+ }
+
+ # skip blank lines, comments, etc.
+ next LINE unless scalar @tok;
+
+ my %tokens;
+ while (@tok) {
+ my ($k, $v) = (shift @tok, shift @tok);
+ next unless defined $v;
+ next unless exists $options{tmap}->{$k};
+ $tokens{$options{tmap}->{$k}} = $v;
+ }
+
+ foreach my $check (sort keys %q) {
+ if (exists $tokens{$check} && defined $q{$check}) {
+ print STDERR "comparing [$tokens{$check}] to [$q{$check}] in line [$line]\n" if $debug;
+ next LINE unless $tokens{$check} eq $q{$check};
+ }
+ else {
+ print STDERR "we could not find [$check] but it's OK\n" if $debug;
+ }
+ }
+
+ print STDERR "line has passed all the search checks\n" if $debug;
+ TOKEN:
+ foreach my $token (sort keys %rmap) {
+ print STDERR "looking for useful token $token\n" if $debug;
+ next unless exists $tokens{$token}; # did we match?
+
+ foreach my $rctoken (@{$rmap{$token}}) {
+ next TOKEN if defined $q{$rctoken}; # don't re-print given tokens
+ }
+
+ print STDERR "FOUND: $token=$tokens{$token}\n" if $debug;
+ printf "%s=%s\n", $token, $tokens{$token};
+ }
+
+ last;
+}
+
+sub load {
+ # this supports pipes too
+ my $io = new IO::File(@_) or die "Could not open [@_]: $!\n";
+ return <$io>; # whole file
+}
--
1.7.9.rc2
^ permalink raw reply related
* Re: [PATCH 1/3] Add contrib/credentials/netrc with GPG support
From: Ted Zlatanov @ 2013-02-04 19:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King
In-Reply-To: <7vvca7291z.fsf@alter.siamese.dyndns.org>
On Mon, 04 Feb 2013 11:06:16 -0800 Junio C Hamano <gitster@pobox.com> wrote:
JCH> Ted Zlatanov <tzz@lifelogs.com> writes:
>> Sorry, I didn't realize contrib/ stuff was under the same rules.
JCH> I had a feeling that this may start out from contrib/ but will soon
JCH> prove to be fairly important to be part of the Git proper.
Cool!
>> It would help if the requirements were codified as the fairly standard
>> Emacs file-local variables, so I can just put them in the Perl code or
>> in .dir-locals.el in the source tree. At least for Perl I'd like that,
>> and it could be nice for the Emacs users who write C too.
>>
>> Would you like me to propose that as a patch?
JCH> I thought that we tend to avoid Emacs/Vim formatting cruft left in
JCH> the file. Do we have any in existing file outside contrib/?
No, but it's a nice way to express the settings so no one is guessing
what the project prefers. At least for me it's not an issue anymore,
since I understand your criteria better now, so let me know if you want
me to express it in the CodingGuidelines, in a dir-locals.el file, or
somewhere else.
>> Either way, I guessed that these settings are what you want as far as
>> tabs and indentation (I use cperl-mode but perl-mode is the same):
>>
>> # -*- mode: cperl; tab-width: 8; cperl-indent-level: 4; indent-tabs-mode: t; -*-
JCH> Indent is done with a Tab and indent level is 8 places (check add--interactive.perl
JCH> and imitate it, perhaps?).
Yup, got it. My mistake on the size-4 indents.
I found this helpful, at least while I was indenting, for anyone else
who might want to indent Perl appropriately to imitate existing Perl code:
# -*- mode: cperl; tab-width: 8; cperl-indent-level: 8; indent-tabs-mode: t; -*-
I'll resubmit now.
Thanks
Ted
^ permalink raw reply
* Re: Bug: file named - on git commit
From: Jonathan Nieder @ 2013-02-04 19:32 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Thomas Rast, Rene Moser, git
In-Reply-To: <7v8v742cwh.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> (some may be too minor to be worth backproting, for
> example).
Yes, this is the part I was asking for help with. Backporting is easy
but convincing the release team and upgrade-averse sysadmins to like
the result generally isn't. Occasional nominations of the form "this
change is important in my workflow" could help.
Continuing to stick to fixes to very severe bugs that stand out plus a
random assortment of problems people have reported can also work fine,
though.
Thanks,
Jonathan
^ permalink raw reply
* Re: [PATCH 1/3] Add contrib/credentials/netrc with GPG support
From: Junio C Hamano @ 2013-02-04 19:06 UTC (permalink / raw)
To: Ted Zlatanov; +Cc: git, Jeff King
In-Reply-To: <87k3qoudxp.fsf@lifelogs.com>
Ted Zlatanov <tzz@lifelogs.com> writes:
> Sorry, I didn't realize contrib/ stuff was under the same rules.
I had a feeling that this may start out from contrib/ but will soon
prove to be fairly important to be part of the Git proper.
> It would help if the requirements were codified as the fairly standard
> Emacs file-local variables, so I can just put them in the Perl code or
> in .dir-locals.el in the source tree. At least for Perl I'd like that,
> and it could be nice for the Emacs users who write C too.
>
> Would you like me to propose that as a patch?
I thought that we tend to avoid Emacs/Vim formatting cruft left in
the file. Do we have any in existing file outside contrib/?
> Either way, I guessed that these settings are what you want as far as
> tabs and indentation (I use cperl-mode but perl-mode is the same):
>
> # -*- mode: cperl; tab-width: 8; cperl-indent-level: 4; indent-tabs-mode: t; -*-
Indent is done with a Tab and indent level is 8 places (check add--interactive.perl
and imitate it, perhaps?).
Thanks.
^ permalink raw reply
* Re: [PATCH 3/3] Fix contrib/credentials/netrc minor issues: exit quietly; use 3-parameter open; etc.
From: Ted Zlatanov @ 2013-02-04 18:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King
In-Reply-To: <7vfw1c2dm5.fsf@alter.siamese.dyndns.org>
On Mon, 04 Feb 2013 09:27:46 -0800 Junio C Hamano <gitster@pobox.com> wrote:
JCH> Ted Zlatanov <tzz@lifelogs.com> writes:
>> Signed-off-by: Ted Zlatanov <tzz@lifelogs.com>
>> ---
>> contrib/credential/netrc/git-credential-netrc | 38 +++++++++++++------------
>> 1 files changed, 20 insertions(+), 18 deletions(-)
JCH> Especially because this is an initial submission, please equash
JCH> three patches into one, instead of sending three "here is my first
JCH> attempt with many problems I know I do not want to be there", "one
JCH> small improvement", "another one to fix remaining issues".
JCH> Otherwise you will waste reviewers' time, getting distracted by
JCH> undesirable details they find in an earlier patch while reviewing,
JCH> without realizing that some of them are fixed in a later one.
OK, thanks. I wasn't sure, since Jeff already reviewed it, if it was
better to squash or not. Ignore this same question in my other reply to
you, and thanks for your patience.
Ted
^ permalink raw reply
* Re: Segmentation fault with latest git (070c57df)
From: Jonathan Nieder @ 2013-02-04 18:34 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, jongman.heo, Thomas Rast, git, Antoine Pelisse
In-Reply-To: <7vboc03u3e.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> The only case that worries me is when make or cc gets interrupted.
> As long as make removes the ultimate target *.o in such a case, it
> is fine to leave a half-written .depend/foo.o.d (or getting it
> removed) behind.
gcc removes the target .o in its signal handler in such a case. In
cases where it doesn't get a chance to (e.g., sudden power failure),
there is a partially written .o file already in place, the linker
produces errors, and the operator is convinced to run "make clean",
all without .depend's help.
^ permalink raw reply
* Re: [PATCH 1/3] Add contrib/credentials/netrc with GPG support
From: Ted Zlatanov @ 2013-02-04 18:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King
In-Reply-To: <7vk3qo2dsc.fsf@alter.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 1969 bytes --]
On Mon, 04 Feb 2013 09:24:03 -0800 Junio C Hamano <gitster@pobox.com> wrote:
JCH> [administrivia: I would really wish you didn't put "Mail-copies-to:
JCH> never" above].
I normally post through GMane and don't need the extra CC on any list I
read. I'll make an effort to remove that header here, and apologize for
the inconvenience.
JCH> Ted Zlatanov <tzz@lifelogs.com> writes:
>> +foreach my $v (values %{$options{tmap}})
>> +{
>> + $options{tmap}->{$v} = $v;
>> +}
JCH> Please follow the styles of existing Perl scripts, e.g. indent with
JCH> tab, etc. Style requests are not optional; it is a prerequisite to
JCH> make the patch readable and reviewable.
Sorry, I didn't realize contrib/ stuff was under the same rules. I will
attempt to make my contributions fit the project's requirements.
It would help if the requirements were codified as the fairly standard
Emacs file-local variables, so I can just put them in the Perl code or
in .dir-locals.el in the source tree. At least for Perl I'd like that,
and it could be nice for the Emacs users who write C too.
Would you like me to propose that as a patch?
Either way, I guessed that these settings are what you want as far as
tabs and indentation (I use cperl-mode but perl-mode is the same):
# -*- mode: cperl; tab-width: 8; cperl-indent-level: 4; indent-tabs-mode: t; -*-
...plus hanging braces and avoiding one-line blocks. I hope that's right.
>> + print <<EOHIPPUS;
>> + ...
>> +EOHIPPUS
JCH> Do we really need to refer readers to Wikipedia or something to
JCH> learn about extinct equid ungulates ;-)?
I think the marker's name is irrelevant, and hope you are OK with
leaving it.
Since the change is a pretty big reformatting, should I squash my 3
commits plus the reformatting commit into one patch, or keep them as a
series?
I am appending the script in its current form so you can review it and
tell me if there's anything else I should add or change in the
formatting.
Thanks
Ted
[-- Attachment #2: git-credential-netrc --]
[-- Type: text/plain, Size: 5958 bytes --]
#!/usr/bin/perl
# -*- mode: cperl; tab-width: 8; cperl-indent-level: 4; indent-tabs-mode: t; -*-
use strict;
use warnings;
use Getopt::Long;
use File::Basename;
my $VERSION = "0.1";
my %options = (
help => 0,
debug => 0,
# identical token maps, e.g. host -> host, will be inserted later
tmap => {
port => 'protocol',
machine => 'host',
path => 'path',
login => 'username',
user => 'username',
password => 'password',
}
);
# map each credential protocol token to itself on the netrc side
$options{tmap}->{$_} = $_ foreach my $v (values %{$options{tmap}});
foreach my $suffix ('.gpg', '') {
foreach my $base (qw/authinfo netrc/) {
my $file = glob("~/.$base$suffix");
next unless (defined $file && -f $file);
$options{file} = $file ;
}
}
Getopt::Long::Configure("bundling");
# TODO: maybe allow the token map $options{tmap} to be configurable.
GetOptions(\%options,
"help|h",
"debug|d",
"file|f=s",
);
if ($options{help}) {
my $shortname = basename($0);
$shortname =~ s/git-credential-//;
print <<EOHIPPUS;
$0 [-f AUTHFILE] [-d] get
Version $VERSION by tzz\@lifelogs.com. License: BSD.
Options:
-f AUTHFILE: specify a netrc-style file
-d: turn on debugging
To enable (note that Git will prepend "git-credential-" to the helper
name and look for it in the path):
git config credential.helper '$shortname -f AUTHFILE'
And if you want lots of debugging info:
git config credential.helper '$shortname -f AUTHFILE -d'
Only "get" mode is supported by this credential helper. It opens
AUTHFILE and looks for entries that match the requested search
criteria:
'port|protocol':
The protocol that will be used (e.g., https). (protocol=X)
'machine|host':
The remote hostname for a network credential. (host=X)
'path':
The path with which the credential will be used. (path=X)
'login|user|username':
The credential’s username, if we already have one. (username=X)
Thus, when we get "protocol=https\nusername=tzz", this credential
helper will look for lines in AUTHFILE that match
port https login tzz
OR
protocol https login tzz
OR... etc. acceptable tokens as listed above. Any unknown tokens are
simply ignored.
Then, the helper will print out whatever tokens it got from the line,
including "password" tokens, mapping e.g. "port" back to "protocol".
The first matching line is used. Tokens can be quoted as 'STRING' or
"STRING".
No caching is performed by this credential helper.
EOHIPPUS
exit;
}
my $mode = shift @ARGV;
# credentials may get 'get', 'store', or 'erase' as parameters but
# only acknowledge 'get'
die "Syntax: $0 [-f AUTHFILE] [-d] get" unless defined $mode;
# only support 'get' mode
exit unless $mode eq 'get';
my $debug = $options{debug};
my $file = $options{file};
die "Sorry, you need to specify an existing netrc file (with or without a .gpg extension) with -f AUTHFILE"
unless defined $file;
unless (-f $file) {
print STDERR "Sorry, the specified netrc $file is not accessible\n" if $debug;
exit 0;
}
my @data;
if ($file =~ m/\.gpg$/) {
@data = load('-|', qw(gpg --decrypt), $file)
}
else {
@data = load('<', $file);
}
chomp @data;
unless (scalar @data) {
print STDERR "Sorry, we could not load data from [$file]\n" if $debug;
exit;
}
# the query: start with every token with no value
my %q = map { $_ => undef } values(%{$options{tmap}});
while (<STDIN>) {
next unless m/([^=]+)=(.+)/;
my ($token, $value) = ($1, $2);
die "Unknown search token $1" unless exists $q{$token};
$q{$token} = $value;
}
# build reverse token map
my %rmap;
foreach my $k (keys %{$options{tmap}}) {
push @{$rmap{$options{tmap}->{$k}}}, $k;
}
# there are CPAN modules to do this better, but we want to avoid
# dependencies and generally, complex netrc-style files are rare
if ($debug) {
printf STDERR "searching for %s = %s\n", $_, $q{$_} || '(any value)'
foreach sort keys %q;
}
LINE: foreach my $line (@data) {
print STDERR "line [$line]\n" if $debug;
my @tok;
# gratefully stolen from Net::Netrc
while (length $line &&
$line =~ s/^("((?:[^"]+|\\.)*)"|((?:[^\\\s]+|\\.)*))\s*//) {
(my $tok = $+) =~ s/\\(.)/$1/g;
push(@tok, $tok);
}
# skip blank lines, comments, etc.
next LINE unless scalar @tok;
my %tokens;
while (@tok) {
my ($k, $v) = (shift @tok, shift @tok);
next unless defined $v;
next unless exists $options{tmap}->{$k};
$tokens{$options{tmap}->{$k}} = $v;
}
foreach my $check (sort keys %q) {
if (exists $tokens{$check} && defined $q{$check}) {
print STDERR "comparing [$tokens{$check}] to [$q{$check}] in line [$line]\n" if $debug;
next LINE unless $tokens{$check} eq $q{$check};
}
else {
print STDERR "we could not find [$check] but it's OK\n" if $debug;
}
}
print STDERR "line has passed all the search checks\n" if $debug;
TOKEN:
foreach my $token (sort keys %rmap) {
print STDERR "looking for useful token $token\n" if $debug;
next unless exists $tokens{$token}; # did we match?
foreach my $rctoken (@{$rmap{$token}}) {
next TOKEN if defined $q{$rctoken}; # don't re-print given tokens
}
print STDERR "FOUND: $token=$tokens{$token}\n" if $debug;
printf "%s=%s\n", $token, $tokens{$token};
}
last;
}
sub load {
# this supports pipes too
my $io = new IO::File(@_) or die "Could not open [@_]: $!\n";
return <$io>; # whole file
}
^ permalink raw reply
* Re: "git archve --format=tar" output changed from 1.8.1 to 1.8.2.1
From: Greg KH @ 2013-02-04 18:26 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Rene Scharfe, git, Konstantin Ryabitsev
In-Reply-To: <7vvca8653g.fsf@alter.siamese.dyndns.org>
On Sun, Feb 03, 2013 at 09:05:55PM -0800, Junio C Hamano wrote:
> Greg KH <gregkh@linuxfoundation.org> writes:
> > The number of people this affects right now is only one (me), given that
> > the offending file is not in Linus's tree right now, so he doesn't have
> > issues with uploading new releases.
>
> As a tree grows larger over time, it may be just a matter of time
> for somebody else to be hit by another deep path, though.
I agree, and over time, everyone will have updated to a version of git
newer than 1.8.2.1 so we all will be fine again :)
thanks,
greg k-h
^ permalink raw reply
* Re: Feature request: Allow extracting revisions into directories
From: Andreas Schwab @ 2013-02-04 18:21 UTC (permalink / raw)
To: Robert Clausecker; +Cc: Michael J Gruber, git
In-Reply-To: <1359980045.24730.32.camel@t520>
Robert Clausecker <fuzxxl@gmail.com> writes:
> I have a server that hosts a bare git repository. This git repository
> contains a branch production. Whenever somebody pushes to production a
> hook automatically puts a copy of the current production branch
> into /var/www/foo. I could of course use pull for that but it just does
> not feels right. Why should I have a repository twice on the server?
You can avoid the separate repo copy by using git new-workdir.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply
* Re: [PATCH 2/2] count-objects: report garbage files in .git/objects/pack directory too
From: Junio C Hamano @ 2013-02-04 18:16 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1359982145-10792-2-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> @@ -1024,11 +1035,15 @@ static void prepare_packed_git_one(char *objdir, int local)
> int namelen = strlen(de->d_name);
> struct packed_git *p;
>
> - if (!has_extension(de->d_name, ".idx"))
> + if (!has_extension(de->d_name, ".idx")) {
> + report_pack_garbage(path, len - 1, de->d_name);
> continue;
> + }
>
> - if (len + namelen + 1 > sizeof(path))
> + if (len + namelen + 1 > sizeof(path)) {
> + report_pack_garbage(path, len - 1, de->d_name);
> continue;
> + }
>
> /* Don't reopen a pack we already have. */
> strcpy(path + len, de->d_name);
> @@ -1042,8 +1057,10 @@ static void prepare_packed_git_one(char *objdir, int local)
> * .pack file that we can map.
> */
> p = add_packed_git(path, len + namelen, local);
> - if (!p)
> + if (!p) {
> + report_pack_garbage(path, len - 1, de->d_name);
> continue;
> + }
> install_packed_git(p);
> }
> closedir(dir);
I forgot to mention one more thing. Your report_pack_garbage()
special cases ".pack" to see if it is a regular file, but this loop
structure causes a regular file whose name ends with ".pack" but
without corresponding ".idx" file to go unreported.
I think the loop should be restructured to iterate over all known
file types and report unknown ones, if you want to repurpose it for
the reporting, something along this line, perhaps:
for (each name) {
if (does it end with ".idx") {
if (is it unusable ".idx") {
report garbage;
}
continue;
}
if (! we are in report mode)
continue;
if (does it end with ".pack") {
if (!have we seen corresponding ".idx")
remember it;
continue;
}
report garbage;
}
for (remembered pack) {
if (does it have corresponding ".idx" &&
is it really usable ".pack")
continue;
report garbage;
}
^ permalink raw reply
* Re: Bug: file named - on git commit
From: Junio C Hamano @ 2013-02-04 17:43 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Thomas Rast, Rene Moser, git
In-Reply-To: <20130128204140.GA7759@google.com>
Jonathan Nieder <jrnieder@gmail.com> writes:
>> This was fixed by Junio around 4682d85 (diff-index.c: "git diff" has no
>> need to read blob from the standard input, 2012-06-27), which is
>> included starting with v1.7.12 and the v1.7.11.3 maint release. Please
>> upgrade.
>
> Should upgrade-averse folks stuck on 1.7.10.y (like Debian 7.0, which
> is currently in the release candidate stage) take this fix? Do you
> happen to know of any other fixes such people would want?
I've been wondering if we can help automating this for backporters.
Because of the way my integration branches are managed, if you run
git log --first-parent v1.8.0..maint-1.8.0
git log --first-parent v1.8.1..maint
the output should give us a birds-eye view (because most are merges
of one or more patches on a topic) of the changes that are fixes,
excluding any feature enhancements.
You can then iterate over the single patches applied directly on top
of maint (or maint-1.8.0) and tips of the topics merged to maint (or
maint-1.8.0) and see if each of them is applicable to maint-1.7.10
codebase. I think you can mechanically reject the ones that are on
'maint' that merge topics that were forked from v1.8.1 as too new.
That hopefully culls the topics that needs manual review and
assessment (some may be too minor to be worth backproting, for
example).
You should be able to do the same for
git log --first-parent v1.8.1..master
There will be fixes and features mixed in the output, but if you
can mechanically narrow down the ones that may be relevant to your
old maintenance track, eyeballing the rest to judge if each of them
is worth backporting will become a manageable task.
^ permalink raw reply
* Re: [PATCH 3/3] Fix contrib/credentials/netrc minor issues: exit quietly; use 3-parameter open; etc.
From: Junio C Hamano @ 2013-02-04 17:27 UTC (permalink / raw)
To: Ted Zlatanov; +Cc: git, Jeff King
In-Reply-To: <87k3qovxlp.fsf_-_@lifelogs.com>
Ted Zlatanov <tzz@lifelogs.com> writes:
> Signed-off-by: Ted Zlatanov <tzz@lifelogs.com>
> ---
> contrib/credential/netrc/git-credential-netrc | 38 +++++++++++++------------
> 1 files changed, 20 insertions(+), 18 deletions(-)
Especially because this is an initial submission, please equash
three patches into one, instead of sending three "here is my first
attempt with many problems I know I do not want to be there", "one
small improvement", "another one to fix remaining issues".
Otherwise you will waste reviewers' time, getting distracted by
undesirable details they find in an earlier patch while reviewing,
without realizing that some of them are fixed in a later one.
Thanks.
^ permalink raw reply
* Re: [PATCH 1/3] Add contrib/credentials/netrc with GPG support
From: Junio C Hamano @ 2013-02-04 17:24 UTC (permalink / raw)
To: Ted Zlatanov; +Cc: git, Jeff King
In-Reply-To: <87sj5cvxnf.fsf_-_@lifelogs.com>
[administrivia: I would really wish you didn't put "Mail-copies-to:
never" above].
Ted Zlatanov <tzz@lifelogs.com> writes:
> +foreach my $v (values %{$options{tmap}})
> +{
> + $options{tmap}->{$v} = $v;
> +}
Please follow the styles of existing Perl scripts, e.g. indent with
tab, etc. Style requests are not optional; it is a prerequisite to
make the patch readable and reviewable.
> + print <<EOHIPPUS;
> + ...
> +EOHIPPUS
Do we really need to refer readers to Wikipedia or something to
learn about extinct equid ungulates ;-)?
^ permalink raw reply
* Re: [WIP/RFH/RFD/PATCH] grep: allow to use textconv filters
From: Junio C Hamano @ 2013-02-04 17:12 UTC (permalink / raw)
To: Michael J Gruber; +Cc: git, Jeff King
In-Reply-To: <2c0641ea4df6a872a4466efe0c0124f304f44c3e.1359991521.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> Recently and not so recently, we made sure that log/grep type operations
> use textconv filters when a userfacing diff would do the same:
>
> ef90ab6 (pickaxe: use textconv for -S counting, 2012-10-28)
> b1c2f57 (diff_grep: use textconv buffers for add/deleted files, 2012-10-28)
> 0508fe5 (combine-diff: respect textconv attributes, 2011-05-23)
>
> "git grep" currently does not use textconv filters at all, that is
> neither for displaying the match and context nor for the actual grepping.
>
> Introduce a binary mode "--textconv" (in addition to "--text" and "-I")
> which makes git grep use any configured textconv filters for grepping
> and output purposes.
>
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
>
> Notes:
> I'm somehow stuck in textconv/filespec/... hell, so I'm sending this out
> in request for help. I'm sure there are people for whom it's a breeze to
> get this right.
Looks like the patch touches the right places in the codepaths that
need to be updated from a quick read.
> The difficulty is in getting the different cases (blob/sha1 vs.
> worktree) right, and in making the changes minimally invasive.
I think grep_source abstraction was intended to be a way for that,
and if what it gives you is not sufficient for your needs, extending
it should not be seen as "invasive" at all.
^ permalink raw reply
* Re: [PATCH 2/2] count-objects: report garbage files in .git/objects/pack directory too
From: Junio C Hamano @ 2013-02-04 17:06 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1359982145-10792-2-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> The hook in prepare_packed_git_one is ugly, but I don't want to
> duplicate the search file logic there in count-objects. Maybe I'm
> wrong.
In this particular case I do not think you are completely wrong;
you are probably only two thirds wrong ;-)
The idea to use a customizable function pointer to allow it do extra
work is probably fine, but adding three identical calls and continue
is a bad taste. Just have one callsite for the error path and do
not hesitate to jump to it with 'goto'.
I do not think failure to add_packed_git() should be treated the
same way as other cases where the files readdir() found are truly
garbage, by the way.
I also wonder, especially because you are enumerating the temporary
pack files in .git/objects/pack/, if it make more sense to account
for their sizes as well. After all, you would end up doing stat()
for a common case of files with ".pack" suffix---doing so for all of
them shouldn't be too bad.
^ permalink raw reply
* Re: [PATCH] git-send-email: add ~/.authinfo parsing
From: Ted Zlatanov @ 2013-02-04 17:00 UTC (permalink / raw)
To: Michal Nazarewicz; +Cc: Jeff King, Junio C Hamano, git, Krzysztof Mazur
In-Reply-To: <xa1tmwvk9gy1.fsf@mina86.com>
On Mon, 04 Feb 2013 17:33:58 +0100 Michal Nazarewicz <mina86@mina86.com> wrote:
MN> As far as I understand, there could be a git-credential helper that
MN> reads ~/.authinfo and than git-send-email would just call “git
MN> credential fill”, right?
MN> I've noticed though, that git-credential does not support port argument,
MN> which makes it slightly incompatible with ~/.authinfo.
My proposed netrc credential helper does this :)
The token mapping I use:
port, protocol => protocol
machine, host => host
path => path
login, username, user => username
password => password
I think that's sensible.
Ted
^ permalink raw reply
* Re: [PATCH 1/3] Add contrib/credentials/netrc with GPG support
From: Ted Zlatanov @ 2013-02-04 16:57 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <87sj5cvxnf.fsf_-_@lifelogs.com>
Grr, sorry for the bad formatting. First time doing format-patch.
Ted
^ permalink raw reply
* Re: Feature request: Allow extracting revisions into directories
From: Junio C Hamano @ 2013-02-04 16:55 UTC (permalink / raw)
To: Andrew Ardill; +Cc: Robert Clausecker, Michael J Gruber, git@vger.kernel.org
In-Reply-To: <CAH5451mp6fRU25LWE+8gk1h6Mz=y_XQHaU-iE0k4=bP0RfzLAA@mail.gmail.com>
Andrew Ardill <andrew.ardill@gmail.com> writes:
> On 4 February 2013 23:14, Robert Clausecker <fuzxxl@gmail.com> wrote:
>> The specific workflow I am planning is this:
>>
>> I have a server that hosts a bare git repository. This git repository
>> contains a branch production. Whenever somebody pushes to production a
>> hook automatically puts a copy of the current production branch
>> into /var/www/foo. I could of course use pull for that but it just does
>> not feels right. Why should I have a repository twice on the server?
>
> Maybe I'm missing something. How does the behaviour you need differ from
>
>> GIT_WORKING_DIR=/var/www/foo git checkout -f <tree-ish>
>
> ??
In addition to the fact that your misspellt environment variable
name will not cause it to write there, you will also be overwriting
the index for your working tree, which presumably you meant is a
location different from the /var/www/foo, with the contents of
<tree-ish>.
^ permalink raw reply
* Re: Feature request: Allow extracting revisions into directories
From: Junio C Hamano @ 2013-02-04 16:52 UTC (permalink / raw)
To: Tomas Carnecky; +Cc: Robert Clausecker, Michael J Gruber, git
In-Reply-To: <1359982065-ner-9588@calvin>
Tomas Carnecky <tomas.carnecky@gmail.com> writes:
> That's what `git checkout` is for. And I would even argue that it's the better
> choice in your situation because it would delete files from /var/www/foo which
> you have deleted in your repo. git archive|tar wouldn't do that.
The point about removal is an interesting one. From that /var/www
location I guess that you are discussing some webapp, but if you let
it _write_ into it, you may also have to worry about how to handle
the case where an update from the source end that comes from the
checkout and an update by the webapp collide with each other.
You also need to maintain the .git/index file that corresponds to
what should be in /var/www/foo/ if you go that route.
Just to be sure, I am not saying "checkout" is an inappropriate
solution to whatever problem you are trying to solve. I am just
pointing out things you need to be aware of if you take that
approach.
^ permalink raw reply
* Re: Segmentation fault with latest git (070c57df)
From: Junio C Hamano @ 2013-02-04 16:46 UTC (permalink / raw)
To: Jeff King; +Cc: jongman.heo, Jonathan Nieder, Thomas Rast, git, Antoine Pelisse
In-Reply-To: <20130204093821.GA32095@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> On Mon, Feb 04, 2013 at 01:16:08AM -0800, Junio C Hamano wrote:
>
>> I think this really boils down to where we draw the "this is good
>> enough" line. I am not sure if losing the file as in $gmane/215211
>> is common enough to be special cased to buy us much, while leaving
>> other ".depend/foo.o.d was updated to contain a wrong info" cases
>> still broken.
>
> Hmm. Yeah, I was thinking it might be more common than ordinary munging
> due to something like an interrupted "git clean -x". But given that:
>
> 1. As far as I can tell, it is not a situation that can happen through
> regular use of checkout/make/etc, and...
>
> 2. We have zero reports of it happening in practice (I only discovered
> it while explicitly trying to break the Makefile), and...
>
> 3. It is just one of many possible breakages, all of which can be
> fixed by "git clean -dx" if you suspect issues...
>
> let's just leave it. Thanks for a sanity check.
The only case that worries me is when make or cc gets interrupted.
As long as make removes the ultimate target *.o in such a case, it
is fine to leave a half-written .depend/foo.o.d (or getting it
removed) behind.
How expensive to generate the dependency for a single foo.c file
into a temporary without compiling it into foo.o, and comparing the
resulting dependency with existing .depend/foo.o.d? If it is very
cheap, it might be worth doing it before linking the final build
product and error the build out when we see discrepancies. I dunno.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox