* [PATCH] git-svn: Fix time zone in --localtime
From: "Wei-Yin Chen (陳威尹)" @ 2011-12-19 8:11 UTC (permalink / raw)
To: git; +Cc: Pete Harlan, Eric Wong, gitster
Use numerical form of time zone to replace alphabetic time zone
abbreviation generated by "%Z". "%Z" is not portable and contain
ambiguity for many areas. For example, CST could be "Central
Standard Time" (GMT-0600) and "China Standard Time" (GMT+0800).
Alphabetic time zone abbreviation is meant for human readability,
not for specifying a time zone for machines.
Failed case can be illustrated like this in linux shell:
> echo $TZ
Asia/Taipei
> date +%Z
CST
> env TZ=`date +%Z` date
Mon Dec 19 06:03:04 CST 2011
> date
Mon Dec 19 14:03:04 CST 2011
Signed-off-by: Wei-Yin Chen (陳威尹) <chen.weiyin@gmail.com>
---
git-svn.perl | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index e30df22..f0b6340 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2029,6 +2029,7 @@ use Carp qw/croak/;
use File::Path qw/mkpath/;
use File::Copy qw/copy/;
use IPC::Open3;
+use Time::Local;
use Memoize; # core since 5.8.0, Jul 2002
use Memoize::Storable;
@@ -3287,6 +3288,14 @@ sub get_untracked {
\@out;
}
+sub get_tz {
+ # some systmes don't handle or mishandle %z, so be creative.
+ my $t = shift || time;
+ my $gm = timelocal(gmtime($t));
+ my $sign = qw( + + - )[ $t <=> $gm ];
+ return sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
+}
+
# parse_svn_date(DATE)
# --------------------
# Given a date (in UTC) from Subversion, return a string in the format
@@ -3319,8 +3328,7 @@ sub parse_svn_date {
delete $ENV{TZ};
}
- my $our_TZ =
- POSIX::strftime('%Z', $S, $M, $H, $d, $m - 1, $Y - 1900);
+ my $our_TZ = get_tz();
# This converts $epoch_in_UTC into our local timezone.
my ($sec, $min, $hour, $mday, $mon, $year,
@@ -5994,7 +6002,6 @@ package Git::SVN::Log;
use strict;
use warnings;
use POSIX qw/strftime/;
-use Time::Local;
use constant commit_log_separator => ('-' x 72) . "\n";
use vars qw/$TZ $limit $color $pager $non_recursive $verbose $oneline
%rusers $show_commit $incremental/;
@@ -6104,11 +6111,8 @@ sub run_pager {
}
sub format_svn_date {
- # some systmes don't handle or mishandle %z, so be creative.
my $t = shift || time;
- my $gm = timelocal(gmtime($t));
- my $sign = qw( + + - )[ $t <=> $gm ];
- my $gmoff = sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
+ my $gmoff = get_tz($t);
return strftime("%Y-%m-%d %H:%M:%S $gmoff (%a, %d %b %Y)", localtime($t));
}
^ permalink raw reply related
* Re: post-receive for web deployment
From: Johannes Sixt @ 2011-12-19 6:55 UTC (permalink / raw)
To: Stephen Major; +Cc: git
In-Reply-To: <CALzTOm+sJHF_7WzjD7bCqAiAbQSV0A3hEX1KdWfFzV7-ePzX2w@mail.gmail.com>
Am 12/19/2011 3:42, schrieb Stephen Major:
> checking the remote server files 4 5 6 are still found in:
> /home/user/domains/domain.com/public_html/live
>
> Why is this happening?
Before you check out the files, you must ensure that the index matches the
content in the GIT_WORK_TREE that you populate by git checkout.
You first push a tree that removes 4 5 6 while the index you happen to
have still has those files recorded, the files are removed. Your second
push does not have these files anymore, but the index does not record the
files anymore, either; therefore, git does not act on the files 4 5 6 that
happen to live in the other worktree.
Perhaps you should maintain separate index files and set GIT_INDEX_FILE
accordingly before git checkout.
-- Hannes
^ permalink raw reply
* Re: best way to fastforward all tracking branches after a fetch
From: Nazri Ramliy @ 2011-12-19 6:31 UTC (permalink / raw)
To: Sitaram Chamarty; +Cc: Gelonida N, git
In-Reply-To: <20111217101106.GB19248@sita-lt.atc.tcs.com>
On Sat, Dec 17, 2011 at 6:11 PM, Sitaram Chamarty <sitaramc@gmail.com> wrote:
> oops; forgot the program...
This is nice!
Stick it on github, or somewhere, please, so that I can always get the
latest and greatest?
Thanks.
nazri
^ permalink raw reply
* What's cooking in git.git (Dec 2011, #06; Sun, 18)
From: Junio C Hamano @ 2011-12-19 5:57 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'.
A handful of topics have graduated to 'master', but they are all minor.
More important features for 1.7.9 will come in the next batch (marked as
'Will merge to "master"' below), which should happen in a couple of days;
Peff's credential series is among them.
Here are the repositories that have my integration branches:
With maint, master, next, pu, todo:
git://git.kernel.org/pub/scm/git/git.git
git://repo.or.cz/alt-git.git
https://code.google.com/p/git-core/
https://github.com/git/git
With only maint and master:
git://git.sourceforge.jp/gitroot/git-core/git.git
git://git-core.git.sourceforge.net/gitroot/git-core/git-core
With all the topics and integration branches:
https://github.com/gitster/git
The preformatted documentation in HTML and man format are found in:
git://git.kernel.org/pub/scm/git/git-{htmldocs,manpages}.git/
git://repo.or.cz/git-{htmldocs,manpages}.git/
https://code.google.com/p/git-{htmldocs,manpages}.git/
https://github.com/gitster/git-{htmldocs,manpages}.git/
--------------------------------------------------
[Graduated to "master"]
* aw/rebase-i-stop-on-failure-to-amend (2011-11-30) 1 commit
(merged to 'next' on 2011-12-09 at a117e83)
+ rebase -i: interrupt rebase when "commit --amend" failed during "reword"
* jc/commit-amend-no-edit (2011-12-08) 5 commits
(merged to 'next' on 2011-12-09 at b9cfa4e)
+ test: commit --amend should honor --no-edit
+ commit: honour --no-edit
+ t7501 (commit): modernize style
+ test: remove a porcelain test that hard-codes commit names
+ test: add missing "&&" after echo command
* jc/stream-to-pack (2011-12-01) 5 commits
(merged to 'next' on 2011-12-09 at d0fd605)
+ bulk-checkin: replace fast-import based implementation
+ csum-file: introduce sha1file_checkpoint
+ finish_tmp_packfile(): a helper function
+ create_tmp_packfile(): a helper function
+ write_pack_header(): a helper function
(this branch is used by jc/split-blob.)
Teaches "git add" to send large-ish blob data straight to a packfile.
This is a continuation to the "large file support" topic. The codepath to
move data from worktree to repository is made aware of streaming, just
like the checkout codepath that goes the other way, which was done in the
previous "large file support" topic in the 1.7.7 cycle.
* jh/fast-import-notes (2011-11-28) 3 commits
(merged to 'next' on 2011-12-09 at 2b01132)
+ fast-import: Fix incorrect fanout level when modifying existing notes refs
+ t9301: Add 2nd testcase exposing bugs in fast-import's notes fanout handling
+ t9301: Fix testcase covering up a bug in fast-import's notes fanout handling
* jk/upload-archive-use-start-command (2011-11-21) 1 commit
(merged to 'next' on 2011-12-09 at 88cb83a)
+ upload-archive: use start_command instead of fork
--------------------------------------------------
[New Topics]
* cn/maint-lf-to-crlf-filter (2011-12-16) 1 commit
- lf_to_crlf_filter(): tell the caller we added "\n" when draining
(this branch is used by jc/maint-lf-to-crlf-keep-crlf.)
A recent fix to the codepath was not quite correct.
Will merge to "next".
* jc/maint-lf-to-crlf-keep-crlf (2011-12-18) 1 commit
- lf_to_crlf_filter(): resurrect CRLF->CRLF hack
(this branch uses cn/maint-lf-to-crlf-filter.)
The lf-to-crlf filter in the streaming checkout codepath forgot that we
try not to convert LF to CRLF if the repository data already has CRLF.
Will merge to "next".
* jc/request-pull-show-head-4 (2011-12-16) 1 commit
(merged to 'next' on 2011-12-16 at bea51ac)
+ request-pull: update the "pull" command generation logic
Will merge to "master".
* jk/doc-fsck (2011-12-16) 1 commit
- docs: brush up obsolete bits of git-fsck manpage
Will merge to "next".
* jk/follow-rename-score (2011-12-16) 1 commit
- use custom rename score during --follow
Will merge to "next".
* jk/pretty-reglog-ent (2011-12-16) 1 commit
- pretty: give placeholders to reflog identity
Will merge to "next".
* jk/http-push-to-empty (2011-12-17) 1 commit
- remote-curl: don't pass back fake refs
Will merge to "next".
* jk/maint-push-v-is-verbose (2011-12-17) 1 commit
- make "git push -v" actually verbose
Will merge to "next".
* jk/maint-strbuf-missing-init (2011-12-18) 2 commits
- Update jk/maint-strbuf-missing-init to builtin/ rename
- commit, merge: initialize static strbuf
Will merge to "next".
* rs/diff-tree-combined-clean-up (2011-12-17) 3 commits
- submodule: use diff_tree_combined_merge() instead of diff_tree_combined()
- pass struct commit to diff_tree_combined_merge()
- use struct sha1_array in diff_tree_combined()
Will merge to "next".
* jn/maint-gitweb-utf8-fix (2011-12-18) 4 commits
- gitweb: Fix fallback mode of to_utf8 subroutine
- gitweb: Output valid utf8 in git_blame_common('data')
- gitweb: esc_html() site name for title in OPML
- gitweb: Call to_utf8() on input string in chop_and_escape_str()
Will merge to "next".
* pw/p4-docs-and-tests (2011-12-18) 11 commits
- git-p4: document and test submit options
- git-p4: test and document --use-client-spec
- git-p4: test --keep-path
- git-p4: test --max-changes
- git-p4: document and test --import-local
- git-p4: honor --changesfile option and test
- git-p4: document and test clone --branch
- git-p4: test cloning with two dirs, clarify doc
- git-p4: clone does not use --git-dir
- git-p4: test debug macro
- git-p4: introduce asciidoc documentation
* jc/advise-push-default (2011-12-18) 2 commits
- push: hint to use push.default=upstream when appropriate
- advice: Document that they all default to true
A counter-proposal to jc/push-ignore-stale that may encourage a bad
workflow.
--------------------------------------------------
[Cooking]
* ef/setenv-putenv (2011-12-14) 2 commits
- compat/setenv.c: error if name contains '='
- compat/setenv.c: update errno when erroring out
(this branch is used by ef/x-setenv-putenv.)
Will merge to "next".
* jk/maint-do-not-feed-stdin-to-tests (2011-12-15) 1 commit
- test-lib: redirect stdin of tests
Will merge to "next".
* jn/test-cleanup-7006 (2011-12-14) 1 commit
- test: errors preparing for a test are not special
Will merge to "next".
* nd/war-on-nul-in-commit (2011-12-15) 3 commits
- commit_tree(): refuse commit messages that contain NULs
- Convert commit_tree() to take strbuf as message
- merge: abort if fails to commit
Will merge to "next".
* jk/git-prompt (2011-12-12) 10 commits
- contrib: add credential helper for OS X Keychain
- Makefile: OS X has /dev/tty
- Makefile: linux has /dev/tty
- credential: use git_prompt instead of git_getpass
- prompt: use git_terminal_prompt
- add generic terminal prompt function
- refactor git_getpass into generic prompt function
- move git_getpass to its own source file
- imap-send: don't check return value of git_getpass
- imap-send: avoid buffer overflow
(this branch uses jk/credentials.)
Will merge to 'next' after taking another look.
* mh/ref-api-rest (2011-12-12) 35 commits
- repack_without_ref(): call clear_packed_ref_cache()
- read_packed_refs(): keep track of the directory being worked in
- is_refname_available(): query only possibly-conflicting references
- refs: read loose references lazily
- read_loose_refs(): take a (ref_entry *) as argument
- struct ref_dir: store a reference to the enclosing ref_cache
- sort_ref_dir(): take (ref_entry *) instead of (ref_dir *)
- do_for_each_ref_in_dir*(): take (ref_entry *) instead of (ref_dir *)
- add_entry(): take (ref_entry *) instead of (ref_dir *)
- search_ref_dir(): take (ref_entry *) instead of (ref_dir *)
- find_containing_direntry(): use (ref_entry *) instead of (ref_dir *)
- add_ref(): take (ref_entry *) instead of (ref_dir *)
- read_packed_refs(): take (ref_entry *) instead of (ref_dir *)
- find_ref(): take (ref_entry *) instead of (ref_dir *)
- is_refname_available(): take (ref_entry *) instead of (ref_dir *)
- get_loose_refs(): return (ref_entry *) instead of (ref_dir *)
- get_packed_refs(): return (ref_entry *) instead of (ref_dir *)
- refs: wrap top-level ref_dirs in ref_entries
- get_ref_dir(): keep track of the current ref_dir
- do_for_each_ref(): only iterate over the subtree that was requested
- refs: sort ref_dirs lazily
- sort_ref_dir(): do not sort if already sorted
- refs: store references hierarchically
- refs.c: rename ref_array -> ref_dir
- struct ref_entry: nest the value part in a union
- check_refname_component(): return 0 for zero-length components
- free_ref_entry(): new function
- refs.c: reorder definitions more logically
- is_refname_available(): reimplement using do_for_each_ref_in_array()
- names_conflict(): simplify implementation
- names_conflict(): new function, extracted from is_refname_available()
- repack_without_ref(): reimplement using do_for_each_ref_in_array()
- do_for_each_ref_in_arrays(): new function
- do_for_each_ref_in_array(): new function
- do_for_each_ref(): correctly terminate while processesing extra_refs
(this branch uses mh/ref-api.)
The API for extra anchoring points may require rethought first; that would
hopefully make the "ref" part a lot simpler.
* ci/stripspace-docs (2011-12-12) 1 commit
(merged to 'next' on 2011-12-13 at 35b2cdf)
+ Update documentation for stripspace
Will merge to "master".
* jk/maint-mv (2011-12-12) 5 commits
(merged to 'next' on 2011-12-13 at 58caedb)
+ mv: be quiet about overwriting
+ mv: improve overwrite warning
+ mv: make non-directory destination error more clear
+ mv: honor --verbose flag
+ docs: mention "-k" for both forms of "git mv"
Will merge to "master".
* jk/maint-snprintf-va-copy (2011-12-12) 1 commit
(merged to 'next' on 2011-12-13 at d37a7e1)
+ compat/snprintf: don't look at va_list twice
Will merge to "master".
* jn/maint-sequencer-fixes (2011-12-12) 7 commits
(merged to 'next' on 2011-12-13 at 5b3950c)
+ revert: stop creating and removing sequencer-old directory
+ Revert "reset: Make reset remove the sequencer state"
+ revert: do not remove state until sequence is finished
+ revert: allow single-pick in the middle of cherry-pick sequence
+ revert: pass around rev-list args in already-parsed form
+ revert: allow cherry-pick --continue to commit before resuming
+ revert: give --continue handling its own function
(this branch is used by rr/revert-cherry-pick.)
Will merge to "master".
* mh/ref-api (2011-12-12) 16 commits
(merged to 'next' on 2011-12-15 at d65a830)
+ add_ref(): take a (struct ref_entry *) parameter
+ create_ref_entry(): extract function from add_ref()
+ repack_without_ref(): remove temporary
+ resolve_gitlink_ref_recursive(): change to work with struct ref_cache
+ Pass a (ref_cache *) to the resolve_gitlink_*() helper functions
+ resolve_gitlink_ref(): improve docstring
+ get_ref_dir(): change signature
+ refs: change signatures of get_packed_refs() and get_loose_refs()
+ is_dup_ref(): extract function from sort_ref_array()
+ add_ref(): add docstring
+ parse_ref_line(): add docstring
+ is_refname_available(): remove the "quiet" argument
+ clear_ref_array(): rename from free_ref_array()
+ refs: rename parameters result -> sha1
+ refs: rename "refname" variables
+ struct ref_entry: document name member
(this branch is used by mh/ref-api-rest.)
Later part split out to expedite moving the earlier good bits forward.
Will merge to "master".
* nd/resolve-ref (2011-12-13) 3 commits
(merged to 'next' on 2011-12-13 at c7002e9)
+ Rename resolve_ref() to resolve_ref_unsafe()
+ Convert resolve_ref+xstrdup to new resolve_refdup function
+ revert: convert resolve_ref() to read_ref_full()
Will merge to "master".
* tr/grep-threading (2011-12-16) 3 commits
- grep: disable threading in non-worktree case
- grep: enable threading with -p and -W using lazy attribute lookup
- grep: load funcname patterns for -W
Will merge to 'next' after taking another look.
* tr/pty-all (2011-12-12) 3 commits
- t/lib-terminal: test test-terminal's sanity
- test-terminal: set output terminals to raw mode
- test-terminal: give the child an empty stdin TTY
The test breakage that originally triggered interest in this topic is
fixed more cleanly with Peff's jk/maint-do-not-feed-stdin-to-tests but
this series may independently be useful.
Jonathan had good review comments, and this would need to be rerolled.
* jc/push-ignore-stale (2011-12-14) 2 commits
- push: --ignore-stale option
- set_ref_status_for_push(): use transport-flags abstraction
Probably solving a wrong problem and encouraging a wrong workflow while at
it. Will drop. jc/advise-push-default might be a better approach.
* jk/fetch-no-tail-match-refs (2011-12-13) 4 commits
(merged to 'next' on 2011-12-13 at 805c018)
+ connect.c: drop path_match function
+ fetch-pack: match refs exactly
+ t5500: give fully-qualified refs to fetch-pack
+ drop "match" parameter from get_remote_heads
Will merge to "master".
* jk/maint-push-over-dav (2011-12-13) 2 commits
(merged to 'next' on 2011-12-13 at 45e376c)
+ http-push: enable "proactive auth"
+ t5540: test DAV push with authentication
Will merge to "master".
* rr/revert-cherry-pick (2011-12-15) 6 commits
- t3502, t3510: clarify cherry-pick -m failure
- t3510 (cherry-pick-sequencer): use exit status
- revert: simplify getting commit subject in format_todo()
- revert: tolerate extra spaces, tabs in insn sheet
- revert: make commit subjects in insn sheet optional
- revert: free msg in format_todo()
(this branch uses jn/maint-sequencer-fixes.)
Picked up only the earlier bits that are reasonably clear for now.
Will merge to "next".
* ew/keepalive (2011-12-05) 1 commit
(merged to 'next' on 2011-12-13 at 1b5d5c4)
+ enable SO_KEEPALIVE for connected TCP sockets
* jc/checkout-m-twoway (2011-12-15) 3 commits
(merged to 'next' on 2011-12-15 at cc64fed)
+ checkout_merged(): squelch false warning from some gcc
(merged to 'next' on 2011-12-11 at b61057f)
+ Test 'checkout -m -- path'
(merged to 'next' on 2011-12-09 at c946009)
+ checkout -m: no need to insist on having all 3 stages
Will merge to "master".
* tr/cache-tree (2011-12-06) 5 commits
(merged to 'next' on 2011-12-13 at e0da64d)
+ reset: update cache-tree data when appropriate
+ commit: write cache-tree data when writing index anyway
+ Refactor cache_tree_update idiom from commit
+ Test the current state of the cache-tree optimization
+ Add test-scrap-cache-tree
Will merge to "master".
* rr/test-chaining (2011-12-11) 7 commits
(merged to 'next' on 2011-12-13 at b08445e)
+ t3401: use test_commit in setup
+ t3401: modernize style
+ t3040 (subprojects-basic): fix '&&' chaining, modernize style
+ t1510 (worktree): fix '&&' chaining
+ t3030 (merge-recursive): use test_expect_code
+ test: fix '&&' chaining
+ t3200 (branch): fix '&&' chaining
Will merge to "master".
* jc/split-blob (2011-12-01) 6 commits
. WIP (streaming chunked)
- chunked-object: fallback checkout codepaths
- bulk-checkin: support chunked-object encoding
- bulk-checkin: allow the same data to be multiply hashed
- new representation types in the packstream
- varint-in-pack: refactor varint encoding/decoding
Not ready. At least pack-objects and fsck need to learn the new encoding
for the series to be usable locally, and then index-pack/unpack-objects
needs to learn it to be used remotely.
* jk/credentials (2011-12-12) 14 commits
(merged to 'next' on 2011-12-12 at 7a6d658)
+ t: add test harness for external credential helpers
+ credentials: add "store" helper
+ strbuf: add strbuf_add*_urlencode
+ Makefile: unix sockets may not available on some platforms
+ credentials: add "cache" helper
+ docs: end-user documentation for the credential subsystem
+ credential: make relevance of http path configurable
+ credential: add credential.*.username
+ credential: apply helper config
+ http: use credential API to get passwords
+ credential: add function for parsing url components
+ introduce credentials API
+ t5550: fix typo
+ test-lib: add test_config_global variant
(this branch is used by jk/git-prompt.)
Later part split out to expedite moving the earlier good bits forward.
Will merge to "master".
* ab/enable-i18n (2011-12-05) 1 commit
(merged to 'next' on 2011-12-13 at 65af8cd)
+ i18n: add infrastructure for translating Git with gettext
* jc/signed-commit (2011-11-29) 5 commits
- gpg-interface: allow use of a custom GPG binary
- pretty: %G[?GS] placeholders
- test "commit -S" and "log --show-signature"
- log: --show-signature
- commit: teach --gpg-sign option
Not exactly urgent.
^ permalink raw reply
* [PATCH 2/2] push: hint to use push.default=upstream when appropriate
From: Junio C Hamano @ 2011-12-19 5:38 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <7vliq9nn0l.fsf@alter.siamese.dyndns.org>
If you push into a shared repository that others push to, and you have
local branches in your repository that matches the remote side but do not
keep them up-to-date, then 'matching refs' is not an appropriate default
for you.
Detect when push failed due to non-fast-forward _and_ we did matching refs
by default (i.e. if the user explicitly said ':' from the command line, or
had push.default set to 'matching', then we do not want to advise), and
give a hint to tell the user that the user may want to set 'push.default'
configuration variable to 'upstream', if the remote repository receives
pushes from other places.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Documentation/config.txt | 6 ++++++
advice.c | 2 ++
advice.h | 1 +
builtin/push.c | 25 +++++++++++++++++++++++++
cache.h | 3 ++-
environment.c | 2 +-
6 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 9be7106..8da7063 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -141,6 +141,12 @@ advice.*::
Advice shown when you used linkgit:git-checkout[1] to
move to the detach HEAD state, to instruct how to create
a local branch after the fact.
+ pushUseUpstream::
+ Advice to set 'push.default' to 'upstream' when you ran
+ linkgit:git-push[1] and pushed 'matching refs' by default
+ (i.e. you did not have any explicit refspec on the command
+ line, and no 'push.default' configuration was set) and it
+ resulted in a non-fast-forward error.
--
core.fileMode::
diff --git a/advice.c b/advice.c
index e02e632..9b56709 100644
--- a/advice.c
+++ b/advice.c
@@ -6,6 +6,7 @@ int advice_commit_before_merge = 1;
int advice_resolve_conflict = 1;
int advice_implicit_identity = 1;
int advice_detached_head = 1;
+int advice_push_use_upstream = 1;
static struct {
const char *name;
@@ -17,6 +18,7 @@ static struct {
{ "resolveconflict", &advice_resolve_conflict },
{ "implicitidentity", &advice_implicit_identity },
{ "detachedhead", &advice_detached_head },
+ { "pushuseupstream", &advice_push_use_upstream },
};
void advise(const char *advice, ...)
diff --git a/advice.h b/advice.h
index e5d0af7..6bb89cd 100644
--- a/advice.h
+++ b/advice.h
@@ -9,6 +9,7 @@ extern int advice_commit_before_merge;
extern int advice_resolve_conflict;
extern int advice_implicit_identity;
extern int advice_detached_head;
+extern int advice_push_use_upstream;
int git_default_advice_config(const char *var, const char *value);
void advise(const char *advice, ...);
diff --git a/builtin/push.c b/builtin/push.c
index 35cce53..5f8c7f4 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -9,6 +9,7 @@
#include "transport.h"
#include "parse-options.h"
#include "submodule.h"
+#include "advice.h"
static const char * const push_usage[] = {
"git push [<options>] [<repository> [<refspec>...]]",
@@ -24,6 +25,7 @@ static int progress;
static const char **refspec;
static int refspec_nr;
static int refspec_alloc;
+static int default_matching_used;
static void add_refspec(const char *ref)
{
@@ -95,6 +97,9 @@ static void setup_default_push_refspecs(struct remote *remote)
{
switch (push_default) {
default:
+ case PUSH_DEFAULT_UNSPECIFIED:
+ default_matching_used = 1;
+ /* fallthru */
case PUSH_DEFAULT_MATCHING:
add_refspec(":");
break;
@@ -114,6 +119,23 @@ static void setup_default_push_refspecs(struct remote *remote)
}
}
+static const char *message_advice_use_upstream[] = {
+ "If you are pushing into a repository that receives pushes from",
+ "repositories other than the current repository, you may want to",
+ "set 'push.default' configuration variable to 'upstream' to avoid",
+ "pushing branches you haven't worked on that others have updated.",
+};
+
+static void advise_use_upstream(void)
+{
+ int i;
+
+ if (!advice_push_use_upstream)
+ return;
+ for (i = 0; i < ARRAY_SIZE(message_advice_use_upstream); i++)
+ advise(message_advice_use_upstream[i]);
+}
+
static int push_with_options(struct transport *transport, int flags)
{
int err;
@@ -136,6 +158,9 @@ static int push_with_options(struct transport *transport, int flags)
err |= transport_disconnect(transport);
+ if (nonfastforward && default_matching_used)
+ advise_use_upstream();
+
if (!err)
return 0;
diff --git a/cache.h b/cache.h
index 627fb6a..6c86725 100644
--- a/cache.h
+++ b/cache.h
@@ -624,7 +624,8 @@ enum push_default_type {
PUSH_DEFAULT_NOTHING = 0,
PUSH_DEFAULT_MATCHING,
PUSH_DEFAULT_UPSTREAM,
- PUSH_DEFAULT_CURRENT
+ PUSH_DEFAULT_CURRENT,
+ PUSH_DEFAULT_UNSPECIFIED
};
extern enum branch_track git_branch_track;
diff --git a/environment.c b/environment.c
index c93b8f4..d7e6c65 100644
--- a/environment.c
+++ b/environment.c
@@ -52,7 +52,7 @@ enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
-enum push_default_type push_default = PUSH_DEFAULT_MATCHING;
+enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
#ifndef OBJECT_CREATION_MODE
#define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
#endif
--
1.7.8.370.gb3269
^ permalink raw reply related
* [PATCH 1/2] advice: Document that they all default to true
From: Junio C Hamano @ 2011-12-19 5:35 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <7vliq9nn0l.fsf@alter.siamese.dyndns.org>
By definition, the default value of "advice.*" variables must be true and
they all control various additional help messages that are designed to aid
new users. Setting one to false is to tell Git that the user understands
the nature of the error and does not need the additional verbose help
message.
Also fix the asciidoc markup for linkgit:git-checkout[1] in the
description of the detachedHead advice by removing an excess colon.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Documentation/config.txt | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 8a7d2d4..9be7106 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -115,35 +115,32 @@ in the appropriate manual page. You will find a description of non-core
porcelain configuration variables in the respective porcelain documentation.
advice.*::
- When set to 'true', display the given optional help message.
- When set to 'false', do not display. The configuration variables
- are:
+ These variables control various optional help messages designed to
+ aid new users. All 'advice.*' variables default to 'true', and you
+ can tell Git that you do not need help by setting these to 'false':
+
--
pushNonFastForward::
Advice shown when linkgit:git-push[1] refuses
- non-fast-forward refs. Default: true.
+ non-fast-forward refs.
statusHints::
Directions on how to stage/unstage/add shown in the
output of linkgit:git-status[1] and the template shown
- when writing commit messages. Default: true.
+ when writing commit messages.
commitBeforeMerge::
Advice shown when linkgit:git-merge[1] refuses to
merge to avoid overwriting local changes.
- Default: true.
resolveConflict::
Advices shown by various commands when conflicts
prevent the operation from being performed.
- Default: true.
implicitIdentity::
Advice on how to set your identity configuration when
your information is guessed from the system username and
- domain name. Default: true.
-
+ domain name.
detachedHead::
- Advice shown when you used linkgit::git-checkout[1] to
+ Advice shown when you used linkgit:git-checkout[1] to
move to the detach HEAD state, to instruct how to create
- a local branch after the fact. Default: true.
+ a local branch after the fact.
--
core.fileMode::
--
1.7.8.370.gb3269
^ permalink raw reply related
* Re: [PATCH 2/2] push: --ignore-stale option
From: Junio C Hamano @ 2011-12-19 5:33 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <7vmxatofvr.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> Jeff King <peff@peff.net> writes:
>
>> But I still see this as solving the wrong problem, and encouraging a
>> dangerous workflow.
>
> Yes, that is what I meant, so we are in total agreement that these people
> should be encouraged not to use the matching semantics.
>
> How that encouragement is made we may differ, though.
So here is my idea of how best to implement such an encouragement.
The first patch is a documentation update/clean-up to prepare for the main
one which is the second.
^ permalink raw reply
* Re: post-receive for web deployment
From: Stephen Major @ 2011-12-19 2:42 UTC (permalink / raw)
To: git
In-Reply-To: <CALzTOmJUqzO8H5UxyFaodi98DBJtFvsbQsHsYh1U=Ggq3NRO5A@mail.gmail.com>
Hello,
I am having some difficulty understanding what I am doing wrong when
working with git to deploy a website through the use of a post-receive
hook on the remote.
Here is the script:
#!/bin/sh
staging_path="/home/user/domains/domain.com/public_html/staging"
live_path="/home/user/domains/domain.com/public_html/live"
while read oldrev newrev ref
do
branch=$(echo $ref | cut -d/ -f3)
# ***
# update the live site
#
if [[ "master" == "$branch" ]]; then
export GIT_WORK_TREE=$live_path
git checkout -f $branch
echo "Release has been pushed to production"
# ***
# we update the staging server with the latest push
#
elif [[ "develop" == "$branch" ]]; then
echo "Resetting staging tree"
export GIT_WORK_TREE=$staging_path
git checkout -f $branch
echo "Develop has been pushed to staging"
fi
done
This is what we have done:
git checkout develop
touch 1 2 3 4 5 6
git add .
git commit -am "added some files"
git push origin develop
checking the remote server now all files are found in:
/home/user/domains/domain.com/public_html/staging
git checkout master
git merge develop
git push origin master
checking the remote server now all files are found in:
/home/user/domains/domain.com/public_html/live
git checkout develop
git rm 4 5 6
git commit -am "removed some files"
git push origin develop
checking the remote server now files 4 5 6 have been removed from:
/home/user/domains/domain.com/public_html/staging
git checkout master
git merge develop
git push origin master
checking the remote server files 4 5 6 are still found in:
/home/user/domains/domain.com/public_html/live
Why is this happening? checking the local repo for master shows the
files are removed there... pulling the latest from origin:master shows
the files have been removed... but why were they not removed from the
working tree like they were on the staging working tree?
well I think it has something to do with later commits and therefor
the working tree of the live server could quickly become out of sync
with the development tree
a quick test, lets checkout master again and perform the removes
directly on it then push it back:
git checkout master
git rm 1 2 3
git commit -am "removed 1 2 3"
git push origin master
checking the remote server now files 1 2 3 have been removed from:
/home/user/domains/domain.com/public_html/live
Okay weird so they remove when the commit happens directly on that
branch and is pushed to the remote but they dont get removed if the
removal happened on a different branch and is merged in then pushed to
the remote....
anyone have an explanation or a workaround?
^ permalink raw reply
* Re: [PATCH] Fix capitalization of "renamelimit" in docs to agree with code
From: Pete Harlan @ 2011-12-19 1:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vsjkhnzkt.fsf@alter.siamese.dyndns.org>
On 12/18/2011 05:02 PM, Junio C Hamano wrote:
> Pete Harlan <pgit@pcharlan.com> writes:
>
>> Signed-off-by: Pete Harlan <pgit@pcharlan.com>
>> ---
>> The documentation and bash-completion have always capitalized
>> "renamelimit" as "renameLimit". The code has always lowercased the
>> whole name. Repair the docs.
>
> Please don't do this.
Sorry for the spam. There was a circumstance at work where it appeared
clear that case wasn't being ignored and it bit us twice. Obviously our
problem lies elsewhere; please forgive the intrusion.
SubmittingPatches says to send to you directly if (and only if) the
patch is ready for inclusion. Next time I won't presume that a patch is
ready without review however obvious that may seem to me at the time.
--Pete
> Exactly because we treat the variable name part (and the top-level section
> part of three-part names) case insensitively, the code lowercases before
> comparing as an implementation detail.
>
> However, you will be naming the same variable whether you spell it using
> all lowercase, or using camelCase (i.e. it does not really matter what
> case the user uses). The camelCase makes it slightly easier to see where
> the word boundaries are than alllowercase, and that is why we try to use
> it in our documentes, which is after all meant to be read by humans.
>
> I would also appreciate if people tried not to overflow my mailbox with an
> incorrect patch that hasn't been discussed and hasn't seen concensus on
> the list that the particular change is a good thing to do, unless the
> patch is about an area that I am an area expert (you can see who the area
> experts are by asking "git shortlog --no-merges -n" or "git blame").
>
> Thanks.
^ permalink raw reply
* Re: [PATCH] Fix capitalization of "renamelimit" in docs to agree with code
From: Junio C Hamano @ 2011-12-19 1:02 UTC (permalink / raw)
To: Pete Harlan; +Cc: git
In-Reply-To: <4EEE86AC.2030802@pcharlan.com>
Pete Harlan <pgit@pcharlan.com> writes:
> Signed-off-by: Pete Harlan <pgit@pcharlan.com>
> ---
> The documentation and bash-completion have always capitalized
> "renamelimit" as "renameLimit". The code has always lowercased the
> whole name. Repair the docs.
Please don't do this.
Exactly because we treat the variable name part (and the top-level section
part of three-part names) case insensitively, the code lowercases before
comparing as an implementation detail.
However, you will be naming the same variable whether you spell it using
all lowercase, or using camelCase (i.e. it does not really matter what
case the user uses). The camelCase makes it slightly easier to see where
the word boundaries are than alllowercase, and that is why we try to use
it in our documentes, which is after all meant to be read by humans.
I would also appreciate if people tried not to overflow my mailbox with an
incorrect patch that hasn't been discussed and hasn't seen concensus on
the list that the particular change is a good thing to do, unless the
patch is about an area that I am an area expert (you can see who the area
experts are by asking "git shortlog --no-merges -n" or "git blame").
Thanks.
^ permalink raw reply
* [PATCH 4/3] gitweb: Fix fallback mode of to_utf8 subroutine
From: Jakub Narebski @ 2011-12-19 0:54 UTC (permalink / raw)
To: git; +Cc: Juergen Kreileder, John Hawley, admin
In-Reply-To: <1324113743-21498-1-git-send-email-jnareb@gmail.com>
e5d3de5 (gitweb: use Perl built-in utf8 function for UTF-8 decoding.,
2007-12-04) was meant to make gitweb faster by using Perl's internals
(see subsection "Messing with Perl's Internals" in Encode(3pm) manpage)
Simple benchmark confirms that (old = 00f429a, new = this version);
note that it is synthetic benchmark of standalone subroutines, not
of gitweb itself
old new
old -- -65%
new 189% --
Unfortunately it made fallback mode of to_utf8 do not work... except
for default value 'latin1' of $fallback_encoding ('latin1' is Perl
native encoding), which is why it was not noticed for such long time.
utf8::valid(STRING) is an internal function that tests whether STRING
is in a _consistent state_ regarding UTF-8. It returns true is
well-formed UTF-8 and has the UTF-8 flag on _*or*_ if string is held
as bytes (both these states are 'consistent'). For gitweb the second
option was true, as output from git commands is opened without ':utf8'
layer.
What made it work at all for STRING in 'latin1' encoding is the fact
that utf8:decode(STRING) turns on UTF-8 flag only if source string is
valid UTF-8 and contains multi-byte UTF-8 characters... and that if
string doesn't have UTF-8 flag set it is treated as in native Perl
encoding, i.e. 'latin1' / 'iso-8859-1' (unless native encoding it is
EBCDIC ;-)). It was ':utf8' layer that actually converted 'latin1'
(no UTF-8 flag == native == 'latin1) to 'utf8'.
Let's make use of the fact that utf8:decode(STRING) returns false if
STRING is invalid as UTF-8 to check whether to enable fallback mode.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Excuse me for overly long commit message...
Resent as part of to_utf8 fixes for better visibility
gitweb/gitweb.perl | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d24763b..75b0970 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1443,8 +1443,7 @@ sub validate_refname {
sub to_utf8 {
my $str = shift;
return undef unless defined $str;
- if (utf8::valid($str)) {
- utf8::decode($str);
+ if (utf8::valid($str) && utf8::decode($str)) {
return $str;
} else {
return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
--
1.7.6
^ permalink raw reply related
* Re: [PATCH] Fix capitalization of "renamelimit" in docs to agree with code
From: Jakub Narebski @ 2011-12-19 0:51 UTC (permalink / raw)
To: Pete Harlan; +Cc: git
In-Reply-To: <4EEE86AC.2030802@pcharlan.com>
Pete Harlan <pgit@pcharlan.com> writes:
> Signed-off-by: Pete Harlan <pgit@pcharlan.com>
> ---
> The documentation and bash-completion have always capitalized
> "renamelimit" as "renameLimit". The code has always lowercased the
> whole name. Repair the docs.
Key names are *case insensitive* so we can write it in docs in a way
that is more clear, like 'renameLimit'.
Code compares with lowercased key name, so that is why it uses
'renamelimit'.
> @@ -2122,7 +2122,7 @@ _git_config ()
> diff.ignoreSubmodules
> diff.mnemonicprefix
> diff.noprefix
> - diff.renameLimit
> + diff.renamelimit
> diff.renames
> diff.suppressBlankEmpty
> diff.tool
Consitency - why you change diff.renameLimit but not
diff.ignoreSubmodules?
--
Jakub Narebski
^ permalink raw reply
* [PATCH] Fix capitalization of "renamelimit" in docs to agree with code
From: Pete Harlan @ 2011-12-19 0:34 UTC (permalink / raw)
To: git, Junio C Hamano
Signed-off-by: Pete Harlan <pgit@pcharlan.com>
---
The documentation and bash-completion have always capitalized
"renamelimit" as "renameLimit". The code has always lowercased the
whole name. Repair the docs.
Documentation/diff-config.txt | 2 +-
Documentation/merge-config.txt | 4 ++--
contrib/completion/git-completion.bash | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt
index 1aed79e..1b9a314 100644
--- a/Documentation/diff-config.txt
+++ b/Documentation/diff-config.txt
@@ -86,7 +86,7 @@ diff.mnemonicprefix::
diff.noprefix::
If set, 'git diff' does not show any source or destination prefix.
-diff.renameLimit::
+diff.renamelimit::
The number of files to consider when performing the copy/rename
detection; equivalent to the 'git diff' option '-l'.
diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt
index 861bd6f..fdb3cb6 100644
--- a/Documentation/merge-config.txt
+++ b/Documentation/merge-config.txt
@@ -32,10 +32,10 @@ merge.log::
actual commits that are being merged. Defaults to false, and
true is a synonym for 20.
-merge.renameLimit::
+merge.renamelimit::
The number of files to consider when performing rename detection
during a merge; if not specified, defaults to the value of
- diff.renameLimit.
+ diff.renamelimit.
merge.renormalize::
Tell git that canonical representation of files in the
diff --git a/contrib/completion/git-completion.bash
b/contrib/completion/git-completion.bash
index cc1bdf9..76f66e1 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2122,7 +2122,7 @@ _git_config ()
diff.ignoreSubmodules
diff.mnemonicprefix
diff.noprefix
- diff.renameLimit
+ diff.renamelimit
diff.renames
diff.suppressBlankEmpty
diff.tool
@@ -2218,7 +2218,7 @@ _git_config ()
merge.
merge.conflictstyle
merge.log
- merge.renameLimit
+ merge.renamelimit
merge.renormalize
merge.stat
merge.tool
--
^ permalink raw reply related
* Re: [RFD] Handling of non-UTF8 data in gitweb
From: Jakub Narebski @ 2011-12-18 22:00 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jürgen Kreileder, John Hawley, Ismail Dönmez
In-Reply-To: <7vehwhcj3q.fsf@alter.siamese.dyndns.org>
On Wed, 7 Dec 2011, Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
> > But doing this would change gitweb behavior. Currently when
> > encountering something (usually line of output) that is not valid
> > UTF-8, we decode it (to UTF-8) using $fallback_encoding, by default
> > 'latin1'. Note however that this value is per gitweb installation,
> > not per repository.
>
> I think we added and you acked 00f429a (gitweb: Handle non UTF-8 text
> better, 2007-06-03) for a good reason, and I think the above argues that
> whatever issue the commit tried to address is a non-issue. Is it really
> true?
Actually... the change in
00f429a (gitweb: Handle non UTF-8 text better, 2007-06-03)
worked correctly, but since
e5d3de5 (gitweb: use Perl built-in utf8 function for UTF-8 decoding., 2007-12-04)
it was changed to a NON-WORKING version - and *nobody* protested.
sub to_utf8 {
my $str = shift;
- my $res;
- eval { $res = decode_utf8($str, Encode::FB_CROAK); };
- if (defined $res) {
- return $res;
+ if (utf8::valid($str)) {
+ utf8::decode($str);
+ return $str;
} else {
return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
}
Well, it works for utf8 and latin1 _only_ (with $fallback_encoding being
set to 'latin1' by default), and for latin1 by historical accident... that
might be why nobody noticed. $fallback_encoding != 'latin1' or 'utf8'
didn't work.
utf8::valid(STRING) is an internal function that tests whether STRING is
in a consistent state regarding UTF-8. It returns true is well-formed
UTF-8 and has the UTF-8 flag on _or_ if string is held as bytes (both
these states are 'consistent'). For gitweb the second option was true.
Note that utf8:decode(STRING) returns false if STRING is invalid as UTF-8.
What makes it all work is the fact that utf8:decode(STRING) turns on UTF-8
flag only if source string is valid UTF-8 and contains multi-byte UTF-8
characters... and that if string doesn't have UTF-8 flag set it is treated
as in native Perl encoding, i.e. 'latin1' / 'iso-8859-1' (unless it is EBCDIC).
It is ':utf8' layer that actually convert 'latin1' to 'utf8'.
-- >8 --
Subject: [PATCH] gitweb: Fix fallback mode of to_utf8 subroutine
e5d3de5 (gitweb: use Perl built-in utf8 function for UTF-8 decoding.,
2007-12-04) was meant to make gitweb faster by using Perl's internals
(see subsection "Messing with Perl's Internals" in Encode(3pm) manpage)
Simple benchmark confirms that (old = 00f429a, new = this version):
old new
old -- -65%
new 189% --
Unfortunately it made fallback mode of to_utf8 do not work... except
for default value 'latin1' of $fallback_encoding ('latin1' is Perl
native encoding), which is why it was not noticed for such long time.
utf8::valid(STRING) is an internal function that tests whether STRING
is in a _consistent state_ regarding UTF-8. It returns true is
well-formed UTF-8 and has the UTF-8 flag on _*or*_ if string is held
as bytes (both these states are 'consistent'). For gitweb the second
option was true, as output from git commands is opened without ':utf8'
layer.
What made it work at all for STRING in 'latin1' encoding is the fact
that utf8:decode(STRING) turns on UTF-8 flag only if source string is
valid UTF-8 and contains multi-byte UTF-8 characters... and that if
string doesn't have UTF-8 flag set it is treated as in native Perl
encoding, i.e. 'latin1' / 'iso-8859-1' (unless native encoding it is
EBCDIC ;-)). It was ':utf8' layer that actually converted 'latin1'
(no UTF-8 flag == native == 'latin1) to 'utf8'.
Let's make use of the fact that utf8:decode(STRING) returns false if
STRING is invalid as UTF-8 to check whether to enable fallback mode.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
I'm sorry for overly wordy commit message...
gitweb/gitweb.perl | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d24763b..75b0970 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1443,8 +1443,7 @@ sub validate_refname {
sub to_utf8 {
my $str = shift;
return undef unless defined $str;
- if (utf8::valid($str)) {
- utf8::decode($str);
+ if (utf8::valid($str) && utf8::decode($str)) {
return $str;
} else {
return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
--
1.7.6
^ permalink raw reply related
* Re: [PATCHv3 02/11] git-p4: test debug macro
From: Junio C Hamano @ 2011-12-18 21:48 UTC (permalink / raw)
To: Pete Wyckoff; +Cc: Jonathan Nieder, Luke Diamand, git
In-Reply-To: <20111218140633.GB16487@padd.com>
Pete Wyckoff <pw@padd.com> writes:
> Call this from a test to have it pause and wait for you to
> investigate. It prints out its current directory and the
> P4 environment variables. It waits for ctrl-c before continuing
> the test.
>
> Signed-off-by: Pete Wyckoff <pw@padd.com>
> ---
...
> diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
> index a870f9a..4c30960 100644
> --- a/t/lib-git-p4.sh
> +++ b/t/lib-git-p4.sh
> @@ -72,3 +72,34 @@ kill_p4d() {
> cleanup_git() {
> rm -rf "$git"
> }
> +
> +#
> +# This is a handy tool when developing or debugging tests. Use
> +...
> +debug() {
> + echo "*** Debug me, hit ctrl-c when done. Useful shell commands:"
> + echo cd \"$(pwd)\"
> + echo export P4PORT=$P4PORT P4CLIENT=$P4CLIENT
> + trap "echo" INT
> + sleep $((3600 * 24 * 30))
> + trap - INT
> +}
> +
You may have found this handy yourself, but I would rather not to see it
here in the current form for multiple reasons.
- Why "ctrl-c"? You are not even spawning shell from here but are having
the user interact with this state in the middle of a test from another
shell, no?
Why not "When done, type <RET>" and have a "read junk" or something
instead? That would be a lot simpler and you do not have to worry about
portability with many lines of comments.
An alternative is to spawn an interactive shell here, and change the
"Debug me" comment to say "ctrl-d when done".
- This is not linked to the generic "debug" option "txxxx-name.sh -d".
Shouldn't you be extending test_debug so that it can go interactive,
give customized comments&insns (i.e. "cd $here" may be useful for test
scripts outside testing p4, but "P4PORT=..." would not be, so the user
of test_debug in t9800-git-p4.* needs customizability of the message).
Also could we please rename p4 related tests in t/t98* series so that it
is clear that they are about git-p4 from "ls t/" output (i.e. have them
all have "git-p4" in their names)?
^ permalink raw reply
* git-p4: labels
From: Luke Diamand @ 2011-12-18 18:33 UTC (permalink / raw)
To: Git List; +Cc: Pete Wyckoff, Michael Horowitz, Vitor Antunes
I've been looking at fixing the --detect-labels flag in git-p4. I'm now
thinking that the current way it's done is just all wrong.
The current code has a few annoying bugs which I mostly have fixes for:
- it only works when there is no more than one label per changelist;
- if the count of files in the p4 label doesn't match the count of files
in the p4 changelist then the label gets dropped (by design);
- git-p4 rebase ignores --detect-labels
- it imports all the label/file mappings each time (I haven't fixed this
yet)
However, the thing that's more annoying is that it only imports labels
when importing the changelist they are pointing at.
So, for example, if you do something like this:
p4 edit; p4 submit
p4 tag TAG1
git-p4 rebase
p4 tag TAG2
git-p4 rebase
then TAG1 will be detected, but TAG2 won't.
This is a particular nuisance for me, as I just have git-p4 running all
the time eating commits, so there's no scope for a human to delay the
git-p4 and pickup the label.
I think what's needed is to do something completely different.
This is speculation at the moment, and I'd welcome comments before I
start hacking.
There will be a new _command_, import-labels. This command will find all
the labels that git knows about, and the labels that p4 knows about, and
then do the obvious diff. It will then create tags as needed directly
(i.e. not using fast-import).
It will unfortunately need to hunt through the revision history looking
for the git hash <h> that matches p4 changelist <c>. This could get
quite slow, although no worse than O(n).
Something like:
p4 edit; p4 submit
p4 tag TAG1
git-p4 rebase
git-p4 import-labels
p4 tag TAG2
git-p4 import-labels
I'm going to try to work up a patch with some test cases but in the
meantime if anyone thinks I've missed something, please let me know.
Thanks
Luke
^ permalink raw reply
* Re: [PATCHv3 02/11] git-p4: test debug macro
From: Luke Diamand @ 2011-12-18 17:10 UTC (permalink / raw)
To: Pete Wyckoff; +Cc: Jonathan Nieder, git
In-Reply-To: <20111218140633.GB16487@padd.com>
On 18/12/11 14:06, Pete Wyckoff wrote:
> Call this from a test to have it pause and wait for you to
> investigate. It prints out its current directory and the
> P4 environment variables. It waits for ctrl-c before continuing
> the test.
Looks good, ack.
>
> Signed-off-by: Pete Wyckoff<pw@padd.com>
> ---
> jrnieder@gmail.com wrote on Sat, 17 Dec 2011 21:26 -0600:
>> Pete Wyckoff wrote:
>>
>>> + # 2 is SIGINT, ash/dash does not know symbolic names
>>> + trap echo 2
>>
>> 'trap "$cmd" INT' works, and it's even in POSIX. ;)
>> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#trap
>
> Nicer to use the constant. It works on both. Unfortunately
> ash has other issues regarding handling ctrl-c from subprocesses.
> Point this out in the comments.
>
> t/lib-git-p4.sh | 31 +++++++++++++++++++++++++++++++
> 1 files changed, 31 insertions(+), 0 deletions(-)
>
> diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
> index a870f9a..4c30960 100644
> --- a/t/lib-git-p4.sh
> +++ b/t/lib-git-p4.sh
> @@ -72,3 +72,34 @@ kill_p4d() {
> cleanup_git() {
> rm -rf "$git"
> }
> +
> +#
> +# This is a handy tool when developing or debugging tests. Use
> +# it inline to pause the script, perhaps like this:
> +#
> +# "$GITP4" clone ...&&
> +# (
> +# cd "$git"&&
> +# debug&&
> +# git log --oneline>lines&&
> +# ...
> +#
> +# Go investigate when it pauses, then hit ctrl-c to continue the
> +# test. The other tests will run, and p4d will be cleaned up nicely.
> +#
> +# Note that the directory is deleted and created for every test run,
> +# so you have to do the "cd" again.
> +#
> +# The continuation feature only works in shells that do not propagate
> +# a child-caught ctrl-c, namely bash. With ash, the entire test run
> +# will exit on the ctrl-c.
> +#
> +debug() {
> + echo "*** Debug me, hit ctrl-c when done. Useful shell commands:"
> + echo cd \"$(pwd)\"
> + echo export P4PORT=$P4PORT P4CLIENT=$P4CLIENT
> + trap "echo" INT
> + sleep $((3600 * 24 * 30))
> + trap - INT
> +}
> +
^ permalink raw reply
* Re: How can I do an automatic stash when doing a checkout?
From: Bruce Stephens brs @ 2011-12-18 15:37 UTC (permalink / raw)
To: DeMarcus; +Cc: git
In-Reply-To: <jckvpk$i8v$1@dough.gmane.org>
DeMarcus <demarcus@hotmail.com> writes:
[...]
> It feels strange doing a commit of partial work. Some of the files may
> not even be supposed to be checked in.
Well, maybe forget about files that you don't expect to keep, but
committing partial work is fine. It's only in your local checkout,
after all; once you've got something worth sharing you can rearrange the
commits so they make sense.
[...]
^ permalink raw reply
* Re: How can I do an automatic stash when doing a checkout?
From: DeMarcus @ 2011-12-18 15:10 UTC (permalink / raw)
To: git
In-Reply-To: <84ty4ycdcc.fsf@cenderis.demon.co.uk>
>> This is not how it works with git, where when I want to change branch
>> I have to do a git checkout. However, that leaves all the modified and
>> untracked files in the directory of the branch I switched to. This is
>> seldom the behavior I want.
>>
>> With the git stash command I can clean the directory the way I want
>> but the stash command is not connected to a particular branch.
>>
>> Is there a way to have git checkout do an automatic stash when doing a
>> checkout to another branch, and then do an automatic git stash apply
>> with the correct stash when changing back to the previous branch
>> again?
>
> You probably don't want to use stash. Just commit whatever partial work
> you've done.
>
It feels strange doing a commit of partial work. Some of the files may
not even be supposed to be checked in.
> You could also just checkout different branches in different
> directories. Nothing wrong with doing that in git.
>
Ok thanks, that would give me the same behavior as I have today.
However, I can see some benefits with have everything in the same
directory as git allows compared to other VCSs. And since the stashing
feature is already there in git, it would be nice if the git checkout
with some flag could use stashing automatically.
^ permalink raw reply
* [PATCHv3 02/11] git-p4: test debug macro
From: Pete Wyckoff @ 2011-12-18 14:06 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Luke Diamand, git
In-Reply-To: <20111218032238.GA6368@elie.hsd1.il.comcast.net>
Call this from a test to have it pause and wait for you to
investigate. It prints out its current directory and the
P4 environment variables. It waits for ctrl-c before continuing
the test.
Signed-off-by: Pete Wyckoff <pw@padd.com>
---
jrnieder@gmail.com wrote on Sat, 17 Dec 2011 21:26 -0600:
> Pete Wyckoff wrote:
>
> > + # 2 is SIGINT, ash/dash does not know symbolic names
> > + trap echo 2
>
> 'trap "$cmd" INT' works, and it's even in POSIX. ;)
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#trap
Nicer to use the constant. It works on both. Unfortunately
ash has other issues regarding handling ctrl-c from subprocesses.
Point this out in the comments.
t/lib-git-p4.sh | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index a870f9a..4c30960 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -72,3 +72,34 @@ kill_p4d() {
cleanup_git() {
rm -rf "$git"
}
+
+#
+# This is a handy tool when developing or debugging tests. Use
+# it inline to pause the script, perhaps like this:
+#
+# "$GITP4" clone ... &&
+# (
+# cd "$git" &&
+# debug &&
+# git log --oneline >lines &&
+# ...
+#
+# Go investigate when it pauses, then hit ctrl-c to continue the
+# test. The other tests will run, and p4d will be cleaned up nicely.
+#
+# Note that the directory is deleted and created for every test run,
+# so you have to do the "cd" again.
+#
+# The continuation feature only works in shells that do not propagate
+# a child-caught ctrl-c, namely bash. With ash, the entire test run
+# will exit on the ctrl-c.
+#
+debug() {
+ echo "*** Debug me, hit ctrl-c when done. Useful shell commands:"
+ echo cd \"$(pwd)\"
+ echo export P4PORT=$P4PORT P4CLIENT=$P4CLIENT
+ trap "echo" INT
+ sleep $((3600 * 24 * 30))
+ trap - INT
+}
+
--
1.7.8.285.gb668d
^ permalink raw reply related
* Re: [PATCHv2 02/11] git-p4: test debug macro
From: Pete Wyckoff @ 2011-12-18 13:50 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Luke Diamand, git
In-Reply-To: <20111218032238.GA6368@elie.hsd1.il.comcast.net>
jrnieder@gmail.com wrote on Sat, 17 Dec 2011 21:26 -0600:
> Pete Wyckoff wrote:
>
> > + # 2 is SIGINT, ash/dash does not know symbolic names
> > + trap echo 2
>
> 'trap "$cmd" INT' works, and it's even in POSIX. ;)
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#trap
Nice! But ash/dash handle subshell INT differently. With ash,
the entire test exits after the ctrl-C, even if caught by a trap in a
subshell. Not so nice. Here's a demonstration.
-----------8<-------------
# shell top.sh
echo top.sh
$SHELL trap.sh
echo top.sh: exit status from trap.sh: $?
echo top.sh: exiting
exit 0
-----------8<-------------
-----------8<-------------
# shell trap.sh
echo trap.sh
trap "echo trap.sh caught INT" INT
sleep 3600
trap - INT
echo trap.sh: exiting
exit 0
-----------8<-------------
Run "bash top.sh". Hit ctrl-c, you'll see:
$ bash top.sh
top.sh
trap.sh
^Ctrap.sh caught INT
trap.sh: exiting
top.sh: exit status from trap.sh: 0
top.sh: exiting
Similarly with "ash top.sh":
$ ash top.sh
top.sh
trap.sh
^Ctrap.sh caught INT
trap.sh: exiting
The top-level script also gets the ctrl-c, but exits on the INT
anyway, after reaping its child. I can't find where POSIX says
if this is correct or not. It isn't how I want it to work here.
I'll add a comment above debug() to explain that it works in bash
but not ash. At least it prints out the P4 environment
information needed to debug.
-- Pete
^ permalink raw reply
* i18n.commitencoding=gbk or --encoding=gbk not work with --pretty=format
From: Yuchen Deng @ 2011-12-18 13:26 UTC (permalink / raw)
To: git
Hi, all!
When set the option i18n.commitencoding value to gbk. I found the 'git log'
ouput encoding always is the default : utf8
git log -n10 --pretty=format:"%h %d %an %s %ci" --topo-order --graph
or
git log -n10 --encoding=utf8 --pretty=format:"%h %d %an %s %ci"
--topo-order --graph
But:
git log --oneline
works well.
I am from China, and the GFW thing, I can't visit git-scm.com.
So, Somebody can help me to report this bug?
I am sure it's don't work for Windows (msys-git) or Linux (Chakra).
Thanks!
--
View this message in context: http://git.661346.n2.nabble.com/i18n-commitencoding-gbk-or-encoding-gbk-not-work-with-pretty-format-tp7105845p7105845.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply
* Re: How can I do an automatic stash when doing a checkout?
From: Bruce Stephens brs @ 2011-12-18 11:45 UTC (permalink / raw)
To: DeMarcus; +Cc: git
In-Reply-To: <jcki8u$oip$1@dough.gmane.org>
DeMarcus <demarcus@hotmail.com> writes:
[...]
> This is not how it works with git, where when I want to change branch
> I have to do a git checkout. However, that leaves all the modified and
> untracked files in the directory of the branch I switched to. This is
> seldom the behavior I want.
>
> With the git stash command I can clean the directory the way I want
> but the stash command is not connected to a particular branch.
>
> Is there a way to have git checkout do an automatic stash when doing a
> checkout to another branch, and then do an automatic git stash apply
> with the correct stash when changing back to the previous branch
> again?
You probably don't want to use stash. Just commit whatever partial work
you've done.
You could also just checkout different branches in different
directories. Nothing wrong with doing that in git.
[...]
^ permalink raw reply
* How can I do an automatic stash when doing a checkout?
From: DeMarcus @ 2011-12-18 11:19 UTC (permalink / raw)
To: git
Hi,
I'm new to git and currently I'm working with SVN and there it's a bit
messier doing branching but once I've branched then all my development
there is completely separated from any other branch. When I want to work
on another branch I just change directory.
This is not how it works with git, where when I want to change branch I
have to do a git checkout. However, that leaves all the modified and
untracked files in the directory of the branch I switched to. This is
seldom the behavior I want.
With the git stash command I can clean the directory the way I want but
the stash command is not connected to a particular branch.
Is there a way to have git checkout do an automatic stash when doing a
checkout to another branch, and then do an automatic git stash apply
with the correct stash when changing back to the previous branch again?
Thanks,
Daniel
^ permalink raw reply
* Re: Escape character for .gitconfig
From: Jeff King @ 2011-12-18 9:51 UTC (permalink / raw)
To: Erik Blake; +Cc: git
In-Reply-To: <4EED9BE5.8060600@icefield.yk.ca>
On Sun, Dec 18, 2011 at 08:53:09AM +0100, Erik Blake wrote:
> That did the trick for this git newb. For the record, I had tried \(,
> /(, double- and single-quoting the entire path (note that git config
> --global had removed the quotes that were originally around the
> string). Did not think of "nested" quotes.
Yeah, if you are using "git config" to enter it on the command line,
you'll have to put an extra layer of quoting around it to pass it
through the shell you're currently running. That's why I showed the
example as the actual config file text. :)
> Now, however, I have a different problem in that notepad++ is somehow
> signalling git that editing is complete before I even get a chance to
> edit the file. I am trying the command
> >git commit --amend
Yep. This is a general problem with editors that open files in an
existing session. The only signal git has of the user being done editing
is when when the editor process exits. For many editors, there is an
option or other trick for sticking around until the file is closed.
I know nothing about notepad++, but a quick google turned up the
"-multiInst" option, which would avoid attaching to the existing
instance. That might work for you.
-Peff
^ 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