Re: [PATCH] precompompose_utf8.c: iconv_open_or_die

2012-08-22 Thread Nguyen Thai Ngoc Duy
On Wed, Aug 22, 2012 at 2:20 AM, Torsten Bögershausen tbo...@web.de wrote:
 +static iconv_t iconv_open_or_die(const char* tocode, const char* fromcode)
 +{
 +   iconv_t my_iconv;
 +   my_iconv = iconv_open(tocode, fromcode);
 +   if (my_iconv == (iconv_t) -1) {
 +   die(_(iconv_open(%s,%s) failed, but needed:\n
 +   core.precomposeunicode not 
 supported.\n),
 +   repo_encoding, path_encoding);

You might want to use die_errno.

 +   }
 +
 +   return my_iconv;
 +}
-- 
Duy
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] fetch/push: allow refs/*:refs/*

2012-08-22 Thread Michael Haggerty
On 08/21/2012 07:37 PM, Junio C Hamano wrote:
 Michael Haggerty mhag...@alum.mit.edu writes:
 
 diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
 index 6207ecd..a3e3fa3 100644
 --- a/builtin/fetch-pack.c
 +++ b/builtin/fetch-pack.c
 @@ -546,7 +546,7 @@ static void filter_refs(struct ref **refs, int 
 nr_match, char **match)
 for (ref = *refs; ref; ref = next) {
 next = ref-next;
 if (!memcmp(ref-name, refs/, 5) 
 -   check_refname_format(ref-name + 5, 0))
 +   check_refname_format(ref-name, 0))
 ; /* trash */
 else if (args.fetch_all 
  (!args.depth || prefixcmp(ref-name, refs/tags/) )) {

 I understand that you didn't introduce this code, but it seems like a
 suspicious combination of conditions:

 if ((ref-name starts with refs/)
 and (ref-name has invalid format))
 
 This protects us from getting contaminated by bogus ref under refs/
 when running fetch refs/heads/*:refs/remotes/origin/* no?
 
 The remote side can also throw phony I have this object, too, but
 not at a particular ref---this entry is only to let you know I have
 it, so that we can negotiate minimal transfer better entries that
 are labelled with strings that do not begin with refs/ and do not
 pass check_refname_format() (and because they are not refs, they do
 not have to pass the test) at us, and we do not want to filter them
 out in this function.  But we do not want anything that is malformed
 under refs/.

Thanks for the explanation.  I'm trying to dig some more into this so
that I can add some documentation, because this area of the code is
rather obscure.

Here is the loop being discussed, in full (from builtin/fetch-pack.c,
filter_refs()):

   for (ref = *refs; ref; ref = next) {
   next = ref-next;
   if (!memcmp(ref-name, refs/, 5) 
   check_refname_format(ref-name, 0))
   ; /* trash */
   else if (args.fetch_all 
(!args.depth || prefixcmp(ref-name, refs/tags/) )) {
   *newtail = ref;
   ref-next = NULL;
   newtail = ref-next;
   continue;
   }
   else {
   int i;
   for (i = 0; i  nr_match; i++) {
   if (!strcmp(ref-name, match[i])) {
   match[i][0] = '\0';
   return_refs[i] = ref;
   break;
   }
   }
   if (i  nr_match)
   continue; /* we will link it later */
   }
   free(ref);
   }

Empirically (determined by instrumenting the code and running the git
test suite):

* The first branch of the if statement is only executed for ref-name of
the form refs/tags/foo^{} for various foo.

* The second branch of the if is *never* executed.

* The third branch is invoked for various reference names under refs/
(including oddballs like refs/for/refs/heads/master, refs/stash,
refs/replace/SHA1), and also for HEAD.

This doesn't quite agree with your explanation, because the phony refs
(at least in this dataset) *do* start with refs/ and they *are* trashed.

I'll continue to try to figure out this area.  I already found an
apparent memory leak...

Michael

-- 
Michael Haggerty
mhag...@alum.mit.edu
http://softwareswirl.blogspot.com/
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Get ciabot configuration from git variables.

2012-08-22 Thread Eric S. Raymond
These changes remove all need to modify the ciabot scripts for installation.
Instead, per-project configuration can be dome via variables in a [ciabot]
section of the config file.

Also, correct for the new server address.

Signed-off-by: Eric S. Raymond e...@thyrsus.com
---
 contrib/ciabot/ciabot.py |  161 +-
 contrib/ciabot/ciabot.sh |  117 +++--
 2 files changed, 158 insertions(+), 120 deletions(-)

diff --git a/contrib/ciabot/ciabot.py b/contrib/ciabot/ciabot.py
index 9775dff..8ce04eb 100755
--- a/contrib/ciabot/ciabot.py
+++ b/contrib/ciabot/ciabot.py
@@ -11,43 +11,41 @@
 #
 # This script is meant to be run either in a post-commit hook or in an
 # update hook.  If there's nothing unusual about your hosting setup,
-# you can specify the project name with a -p option and avoid having
-# to modify this script.  Try it with -n to see the notification mail
-# dumped to stdout and verify that it looks sane. With -V it dumps its
-# version and exits.
+# you can specify the project name and repo with config variables and
+# avoid having to modify this script.  Try it with -n to see the
+# notification mail dumped to stdout and verify that it looks
+# sane. With -V it dumps its version and exits.
 #
-# In post-commit, run it without arguments (other than possibly a -p
-# option). It will query for current HEAD and the latest commit ID to
-# get the information it needs.
+# In post-commit, run it without arguments. It will query for
+# current HEAD and the latest commit ID to get the information it
+# needs.
 #
 # In update, call it with a refname followed by a list of commits:
-# You want to reverse the order git rev-list emits becxause it lists
+# You want to reverse the order git rev-list emits because it lists
 # from most recent to oldest.
 #
 # /path/to/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac)
 #
-# Note: this script uses mail, not XML-RPC, in order to avoid stalling
-# until timeout when the CIA XML-RPC server is down.
+# Configuration variables affecting this script:
+# ciabot.project = name of the project (required)
+# ciabot.repo = name of the project repo for gitweb/cgit purposes
+# ciabot.xmlrpc  = if true (default), ship notifications via XML-RPC
+# ciabot.revformat = format in which the revision is shown
 #
-
-#
-# The project as known to CIA. You will either want to change this
-# or invoke the script with a -p option to set it.
+# The ciabot.repo value defaults to ciabot.project lowercased.
 #
-project=None
-
+# The revformat variable may have the following values
+# raw - full hex ID of commit
+# short - first 12 chars of hex ID
+# describe = - describe relative to last tag, falling back to short
+# The default is 'describe'.
 #
-# You may not need to change these:
+# Note: the CIA project now says only XML-RPC is reliable, so
+# we default to that.
 #
-import os, sys, commands, socket, urllib
-
-# Name of the repository.
-# You can hardwire this to make the script faster.
-repo = os.path.basename(os.getcwd())
 
-# Fully-qualified domain name of this host.
-# You can hardwire this to make the script faster.
-host = socket.getfqdn()
+import os, sys, commands, socket, urllib
+from xml.sax.saxutils import escape
 
 # Changeset URL prefix for your repo: when the commit ID is appended
 # to this, it should point at a CGI that will display the commit
@@ -72,7 +70,7 @@ xml = '''\
 message
   generator
 nameCIA Python client for Git/name
-version%(gitver)s/version
+version%(version)s/version
 url%(generator)s/url
   /generator
   source
@@ -98,19 +96,18 @@ xml = '''\
 # No user-serviceable parts below this line:
 #
 
-# Addresses for the e-mail. The from address is a dummy, since CIA
-# will never reply to this mail.
-fromaddr = CIABOT-NOREPLY@ + host
-toaddr = c...@cia.navi.cx
+# Where to ship e-mail notifications.
+toaddr = c...@cia.vc
 
 # Identify the generator script.
 # Should only change when the script itself gets a new home and maintainer.
-generator=http://www.catb.org/~esr/ciabot.py;
+generator = http://www.catb.org/~esr/ciabot.py;
+version = 3.5
 
 def do(command):
 return commands.getstatusoutput(command)[1]
 
-def report(refname, merged):
+def report(refname, merged, xmlrpc=True):
 Generate a commit notification to be reported to CIA
 
 # Try to tinyfy a reference to a web view for this commit.
@@ -121,32 +118,27 @@ def report(refname, merged):
 
 branch = os.path.basename(refname)
 
-# Compute a shortnane for the revision
-rev = do(git describe '+ merged +' 2/dev/null) or merged[:12]
-
-# Extract the neta-information for the commit
-rawcommit = do(git cat-file commit  + merged)
+# Compute a description for the revision
+if revformat == 'raw':
+rev = merged
+elif revformat == 'short':
+rev = ''
+else: # revformat == 'describe'
+rev = do(git describe %s 2/dev/null % merged)
+if not rev:
+rev = 

[PATCH] Document the --done option.

2012-08-22 Thread Eric S. Raymond
---
 Documentation/git-fast-import.txt |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-fast-import.txt 
b/Documentation/git-fast-import.txt
index 2620d28..9291ea0 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -39,6 +39,10 @@ OPTIONS
See ``Date Formats'' below for details about which formats
are supported, and their syntax.
 
+-- done::
+   Terminate with error if there is no 'done' command at the 
+   end of the stream.
+
 --force::
Force updating modified existing branches, even if doing
so would cause commits to be lost (as the new commit does
@@ -1047,7 +1051,9 @@ done::
Error out if the stream ends without a 'done' command.
Without this feature, errors causing the frontend to end
abruptly at a convenient point in the stream can go
-   undetected.
+   undetected.  This may occur, for example, if an import
+   front end dies in mid-operation without emitting SIGTERM
+   or SIGKILL at its subordinate git fast-import instance.
 
 `option`
 
-- 
1.7.9.5


-- 
a href=http://www.catb.org/~esr/;Eric S. Raymond/a
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Support generate poison .mo files for testing

2012-08-22 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy pclo...@gmail.com writes:

 test-poisongen does a similar job to gettext poison feature except
 that it does it at build time. Gibberish .mo files are generated for
 all supported langauges and put in po/build/poison-locale. Target
 poison-locale is for this.

What is the significance of this locale being Gibberish?
Currently, for any string, we give ### gettext poison ### or
something but the only thing we care about in the poison mode is
that it is different from the message id, no?  I was wondering if
these phony translations can be something simple like Add QQ at the
beginning of the message id string and still can catch mistakenly
marked messages that come from the plumbing layer, or something.

As you have already written a printf skipper that looks fairly
conservative, perhaps I shouldn't be worried too much about it, but
we seem to be spending considerable effort on the poison, and it
makes me wonder (even though no better alternative comes to mind) if
we could do better.  The reason we do poison (be it the current
one or locale based one) in the first place is so that we want to
make sure messages from the plumbing are not marked for i18n, and we
do so by running our test under the poison mode that produces
output different from the in-code text that are marked for i18n,
which somehow feels quite a roundabout way of doing so.

 User can run the test with these .mo files by setting POISON_LOCALE
 while running the test suite. User must also set LANG/LC_* correctly
 (and the system is supposed to support that locale).

  OK let me redo step one. test-poisongen requires libgettextpo. I'm
  not sure if this library if gnu specific. We may need another flag
  for it instead of NO_GETTEXT. We don't need a fake language code with
  this approach.

OK.

  Makefile |  19 
  t/test-lib.sh|  10 +++-
  test-poisongen.c | 139 
 +++
  wrap-for-bin.sh  |   6 ++-
  4 files changed, 171 insertions(+), 3 deletions(-)
  mode change 100644 = 100755 t/test-lib.sh
  create mode 100644 test-poisongen.c
  mode change 100644 = 100755 wrap-for-bin.sh

Thanks.  I suspect two mode changes weren't intentional?

 +static void translate(const char *msg, struct strbuf *buf)
 +{
 + const char *end = msg + strlen(msg);
 + const char *text = * GETTEXT POISON *;
 + int text_len = strlen(text);
 + int t = 0;
 +
 + strbuf_reset(buf);
 + /* preserve \n and printf format specifiers because msgfmt
 +barfs otherwise. */
 + while (msg  end) {
 + /* printf specifiers and shell variables, it's a quite
 +relax check */
 + if ((*msg == '%' || *msg == '$')  msg+1  end) {
 + strbuf_addch(buf, *msg++);
 + do
 +strbuf_addch(buf, *msg);
 + while (msg  end  !isspace(*msg++));
 + } else if (*msg == '\n') {
 + /* we only need to preserve trailing newlines, doing
 +more does not really harm */
 + strbuf_addch(buf, '\n');
 + msg++;
 + } else {
 + strbuf_addch(buf, text[t]);
 + t = (t + 1) % text_len;
 + msg++;
 + }
 + }
 +}
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Q] Comparing differences introduced by two commits?

2012-08-22 Thread Brian Foster

Hello,

 I have two commits A and B.  They are on separate branches.
 Commit A is a older version of B.  I want to see what, if
 any, differences there are between what commit A changes
 and what commit B changes.  (The relative positions of
 two commits may also differ in the two branches; that is, 
 there may have been some commit re-ordering.)

 Ideally, the contents of the commit-message are also taken
 into account (albeit things like the commit-Id, dates, and
 so on will differ and therefore should be ignored).

 I realize the history leading up to each commit can itself
 cause what the commits change to differ, even if the net
 result of the two commits is the same.  For my purposes,
 this is a noise issue, and I'm happy to consider A and B 
 as not causing the same changes (i.e., as being different),
 albeit if the only difference is the line numbers, then it
 would be nice to ignore that.

 In the past I've done:

diff (git show A) (git show B)

 which produces rather messy output but is Ok when dealing
 with just one or two sets of A/B commits.  I now have a
 large-ist set of A/B commits, and the above is impractical.

 Some searching hasn't found any suggestions I'm too happy
 with, albeit I've very possibly overlooked something.

 Any suggestions?
cheers!
-blf-

-- 
Brian Foster
Principal MTS, Software|  La Ciotat, France
Maxim Integrated Products  |  Web:  http://www.maxim-ic.com/

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Support generate poison .mo files for testing

2012-08-22 Thread Nguyen Thai Ngoc Duy
On Wed, Aug 22, 2012 at 6:13 PM, Junio C Hamano gits...@pobox.com wrote:
 Nguyễn Thái Ngọc Duy pclo...@gmail.com writes:

 test-poisongen does a similar job to gettext poison feature except
 that it does it at build time. Gibberish .mo files are generated for
 all supported langauges and put in po/build/poison-locale. Target
 poison-locale is for this.

 What is the significance of this locale being Gibberish?
 Currently, for any string, we give ### gettext poison ### or
 something but the only thing we care about in the poison mode is
 that it is different from the message id, no?  I was wondering if
 these phony translations can be something simple like Add QQ at the
 beginning of the message id string and still can catch mistakenly
 marked messages that come from the plumbing layer, or something.

I'm gradually getting there, partly thanks to your question about
grepping tracked in another thread. This patch does not really
generate random strings. It repeats the pattern * gettext poison *
for evey character that can be replaced. But a better way could be
replacing tracked with t r a c k e d. We know the rule so we can
recreate the that string from tracked in test_i18n*. Or reverse the
upper/lower case, whichever is easier for the recreation by test_i18n*

  mode change 100644 = 100755 t/test-lib.sh
  create mode 100644 test-poisongen.c
  mode change 100644 = 100755 wrap-for-bin.sh

 Thanks.  I suspect two mode changes weren't intentional?

It's an emacs hook gone bad.
-- 
Duy
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] l10n: preserve trailing spaces in Vietnamese translation

2012-08-22 Thread Nguyễn Thái Ngọc Duy
The trailing spaces in msgid can be used to separate the next
word. Accidentally removing it means we may see On branchmaster
instead of On branch master.

While at it, remove trailing space in translation if the original one
does not have it.

Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com
---
 po/vi.po | 22 +++---
 1 tập tin đã bị thay đổi, 11 được thêm vào(+), 11 bị xóa(-)

diff --git a/po/vi.po b/po/vi.po
index f2c77ec..bd0f953 100644
--- a/po/vi.po
+++ b/po/vi.po
@@ -1047,11 +1047,11 @@ msgstr  lần chuyển giao (commit) mới, 
 
 #: wt-status.c:287
 msgid modified content, 
-msgstr nội dung được sửa đổi,
+msgstr nội dung được sửa đổi, 
 
 #: wt-status.c:289
 msgid untracked content, 
-msgstr nội dung chưa được theo dõi
+msgstr nội dung chưa được theo dõi 
 
 #: wt-status.c:303
 #, c-format
@@ -1194,7 +1194,7 @@ msgstr   (sử dụng \git bisect reset\ để quay trở lại 
nhánh nguyê
 
 #: wt-status.c:978
 msgid On branch 
-msgstr Trên nhánh
+msgstr Trên nhánh 
 
 #: wt-status.c:985
 msgid Not currently on any branch.
@@ -1268,20 +1268,20 @@ msgstr HEAD (chưa có nhánh nào)
 
 #: wt-status.c:1156
 msgid Initial commit on 
-msgstr Lần chuyển giao (commit)  khởi tạo trên
+msgstr Lần chuyển giao (commit)  khởi tạo trên 
 
 #: wt-status.c:1171
 msgid behind 
-msgstr đằng sau
+msgstr đằng sau 
 
 #: wt-status.c:1174
 #: wt-status.c:1177
 msgid ahead 
-msgstr phía trước
+msgstr phía trước 
 
 #: wt-status.c:1179
 msgid , behind 
-msgstr , đằng sau
+msgstr , đằng sau 
 
 #: builtin/add.c:62
 #, c-format
@@ -3506,7 +3506,7 @@ msgstr không thể lưu trữ tập tin ghi mục lục
 #: builtin/index-pack.c:1398
 #, c-format
 msgid Cannot open existing pack file '%s'
-msgstr Không thể mở tập tin pack đã sẵn có '%s' 
+msgstr Không thể mở tập tin pack đã sẵn có '%s'
 
 #: builtin/index-pack.c:1400
 #, c-format
@@ -5385,7 +5385,7 @@ msgstr Thân của lần chuyển giao (commit) là:
 #. input at this point.
 #: git-am.sh:764
 msgid Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all 
-msgstr Áp dụng? đồng ý [y]/không [n]/chỉnh sửa [e]/hiển thị miếng [v]á/đồng ý 
tất cả [a]
+msgstr Áp dụng? đồng ý [y]/không [n]/chỉnh sửa [e]/hiển thị miếng [v]á/đồng ý 
tất cả [a] 
 
 #: git-am.sh:800
 #, sh-format
@@ -5495,7 +5495,7 @@ msgstr Cảnh báo: chỉ thực hiện việc bisect với một lần 
chuyể
 #. at this point.
 #: git-bisect.sh:279
 msgid Are you sure [Y/n]? 
-msgstr Bạn có chắc chắn chưa [Y/n]?
+msgstr Bạn có chắc chắn chưa [Y/n]? 
 
 #: git-bisect.sh:289
 msgid 
@@ -5693,7 +5693,7 @@ msgstr dòng ngược không hợp lệ $upstream_name
 #: git-rebase.sh:419
 #, sh-format
 msgid $onto_name: there are more than one merge bases
-msgstr $onto_name: ở đây có nhiều hơn một 
+msgstr $onto_name: ở đây có nhiều hơn một
 
 #: git-rebase.sh:422
 #: git-rebase.sh:426
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] am: quote string for translation before passing to eval_gettextln

2012-08-22 Thread Nguyễn Thái Ngọc Duy
If it's not quoted, the string is expanded before it gets looked up in
gettext database and obviously nothing is returned.

Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com
---
 On Wed, Aug 22, 2012 at 9:17 PM, Jonathan Nieder jrnie...@gmail.com wrote:
  Nguyen Thai Ngoc Duy wrote:
 
  which means git performed a lookup on that string. It is from git-am.sh:
 
  eval_gettextln The copy of the patch that failed is found in:
 $dotest/patch
 
  Good catch.  It should use single-quotes.

 Yep. Verified. Also checked that no other places have this problem.
 xgettext probably detects this too. Without this patch it does not
 collect this string. With this patch, it does.

 git-am.sh | 4 ++--
 1 tập tin đã bị thay đổi, 2 được thêm vào(+), 2 bị xóa(-)

diff --git a/git-am.sh b/git-am.sh
index bd9620c..c682d34 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -855,8 +855,8 @@ did you forget to use 'git add'?
eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
if test $(git config --bool advice.amworkdir) != false
then
-   eval_gettextln The copy of the patch that failed is 
found in:
-   $dotest/patch
+   eval_gettextln 'The copy of the patch that failed is 
found in:
+   $dotest/patch'
fi
stop_here_user_resolve $this
fi
-- 
1.7.12.rc2.18.g61b472e

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact

2012-08-22 Thread Joachim Schmitz

Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
---
 Makefile| 18 ++
 compat/win32/poll.c |  8 ++--
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 6b0c961..2af4db3 100644
--- a/Makefile
+++ b/Makefile
@@ -152,6 +152,11 @@ all::
 #
 # Define NO_MMAP if you want to avoid mmap.
 #
+# Define NO_SYS_POLL_H if you don't have sys/poll.h.
+#
+# Define NO_POLL if you do not have or do not want to use poll.
+# This also implies NO_SYS_POLL_H.
+#
 # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
 #
 # Define NO_PREAD if you have a problem with pread() system call (e.g.
@@ -1216,7 +1221,7 @@ ifeq ($(uname_S),Windows)
NO_PREAD = YesPlease
NEEDS_CRYPTO_WITH_SSL = YesPlease
NO_LIBGEN_H = YesPlease
-   NO_SYS_POLL_H = YesPlease
+   NO_POLL = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_IPV6 = YesPlease
NO_UNIX_SOCKETS = YesPlease
@@ -1257,7 +1262,7 @@ ifeq ($(uname_S),Windows)
BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild
-Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H
-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
COMPAT_OBJS = compat/msvc.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
-   compat/win32/poll.o compat/win32/dirent.o
+   compat/win32/dirent.o
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H
-DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32
-DSTRIP_EXTENSION=\.exe\
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
-NODEFAULTLIB:MSVCRT.lib
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib
@@ -1312,7 +1317,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_PREAD = YesPlease
NEEDS_CRYPTO_WITH_SSL = YesPlease
NO_LIBGEN_H = YesPlease
-   NO_SYS_POLL_H = YesPlease
+   NO_POLL = YesPlease
NO_SYMLINK_HEAD = YesPlease
NO_UNIX_SOCKETS = YesPlease
NO_SETENV = YesPlease
@@ -1347,7 +1352,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\.exe\
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
compat/win32/pthread.o compat/win32/syslog.o \
-   compat/win32/poll.o compat/win32/dirent.o
+   compat/win32/dirent.o
EXTLIBS += -lws2_32
PTHREAD_LIBS =
X = .exe
@@ -1601,6 +1606,11 @@ ifdef NO_GETTEXT
BASIC_CFLAGS += -DNO_GETTEXT
USE_GETTEXT_SCHEME ?= fallthrough
 endif
+ifdef NO_POLL
+   NO_SYS_POLL_H = YesPlease
+   COMPAT_CFLAGS += -DNO_POLL -Icompat/win32 # so it find poll.h
+   COMPAT_OBJS += compat/win32/poll.c
+endif
 ifdef NO_STRCASESTR
COMPAT_CFLAGS += -DNO_STRCASESTR
COMPAT_OBJS += compat/strcasestr.o
diff --git a/compat/win32/poll.c b/compat/win32/poll.c
index 403eaa7..49541f1 100644
--- a/compat/win32/poll.c
+++ b/compat/win32/poll.c
@@ -24,7 +24,9 @@
 # pragma GCC diagnostic ignored -Wtype-limits
 #endif

-#include malloc.h
+#if defined(WIN32)
+# include malloc.h
+#endif

 #include sys/types.h

@@ -48,7 +50,9 @@
 #else
 # include sys/time.h
 # include sys/socket.h
-# include sys/select.h
+# ifndef NO_SYS_SELECT_H
+#  include sys/select.h
+# endif
 # include unistd.h
 #endif

--
1.7.12

HP NonStop is using this, patch to add this is to follow.

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Joachim Schmitz

Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
---
 http.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/http.c b/http.c
index b61ac85..18bc6bf 100644
--- a/http.c
+++ b/http.c
@@ -806,10 +806,12 @@ static int http_request(const char *url, void *result,
int target, int options)
ret = HTTP_REAUTH;
}
} else {
+#if LIBCURL_VERSION_NUM = 0x070c00
if (!curl_errorstr[0])
strlcpy(curl_errorstr,
 
curl_easy_strerror(results.curl_result),
sizeof(curl_errorstr));
+#endif
ret = HTTP_ERROR;
}
} else {
--
1.7.12

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Prefer sysconf(_SC_OPEN_MAX) over getrlimit(RLIMIT_NOFILE,...)

2012-08-22 Thread Joachim Schmitz

Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
---
 sha1_file.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/sha1_file.c b/sha1_file.c
index af5cfbd..76714ad 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -747,6 +747,9 @@ static int open_packed_git_1(struct packed_git *p)
return error(packfile %s index unavailable, p-pack_name);

if (!pack_max_fds) {
+#ifdef _SC_OPEN_MAX
+   unsigned int max_fds = sysconf(_SC_OPEN_MAX);
+#else
struct rlimit lim;
unsigned int max_fds;

@@ -754,6 +757,7 @@ static int open_packed_git_1(struct packed_git *p)
die_errno(cannot get RLIMIT_NOFILE);

max_fds = lim.rlim_cur;
+#endif

/* Save 3 for stdin/stdout/stderr, 22 for work */
if (25  max_fds)
--
1.7.12


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Q] Comparing differences introduced by two commits?

2012-08-22 Thread Jonathan del Strother
On 22 August 2012 13:10, Brian Foster brian.fos...@maxim-ic.com wrote:

 Hello,

  I have two commits A and B.  They are on separate branches.
  Commit A is a older version of B.  I want to see what, if
  any, differences there are between what commit A changes
  and what commit B changes.  (The relative positions of
  two commits may also differ in the two branches; that is,
  there may have been some commit re-ordering.)

  Ideally, the contents of the commit-message are also taken
  into account (albeit things like the commit-Id, dates, and
  so on will differ and therefore should be ignored).

  I realize the history leading up to each commit can itself
  cause what the commits change to differ, even if the net
  result of the two commits is the same.  For my purposes,
  this is a noise issue, and I'm happy to consider A and B
  as not causing the same changes (i.e., as being different),
  albeit if the only difference is the line numbers, then it
  would be nice to ignore that.

  In the past I've done:

 diff (git show A) (git show B)

  which produces rather messy output but is Ok when dealing
  with just one or two sets of A/B commits.  I now have a
  large-ist set of A/B commits, and the above is impractical.

  Some searching hasn't found any suggestions I'm too happy
  with, albeit I've very possibly overlooked something.

What about cherry picking B onto A, then showing the cherry-picked commit?

Off the top of my head :

git checkout A
git cherry-pick B
git show HEAD

-Jonathan
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Support generate poison .mo files for testing

2012-08-22 Thread Junio C Hamano
Nguyen Thai Ngoc Duy pclo...@gmail.com writes:

 But a better way could be
 replacing tracked with t r a c k e d. We know the rule so we can
 recreate the that string from tracked in test_i18n*. Or reverse the
 upper/lower case, whichever is easier for the recreation by test_i18n*

That does not make much sense to me, so either one of us must be
slightly confused.  I thought the only purpose of testing with the
poison was to find messages that must not be localized but were
localized by mistake.  For that, we have to make sure that anything
that uses test_i18n* is reading from Porcelain, in other words, we
must use the byte-for-byte comparison without using test_i18n* when
verifying the plumbing output.  And the primary requirement for this
arrangement to work is that the expected output in C locale and the
actual ouptut in the synthetic poison locale are reliably different.
They do not have to be reversible (I was actually going to suggest
rot13 of the original instead of cycling through the * gettext
poison * in your patch --- prefixing with QQ would not work, as it
is likely that the test with grep may not be anchored at the left
end).

Teaching test_i18n* to fuzzily match the expected output in C locale
against the actual output in synthetic poison locale may or may not
be doable, but spending any cycle working on that sounds like a
total waste of time (even though it might be fun).  It does not test
that we are translating Porcelain messages correctly.

Am I missing something?  Puzzled...
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Porting git to HP NonStop

2012-08-22 Thread Joachim Schmitz
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Monday, August 20, 2012 6:54 PM
 To: Joachim Schmitz
 Cc: 'Shawn Pearce'; git@vger.kernel.org; rsbec...@nexbridge.com
 Subject: Re: Porting git to HP NonStop
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  I haven't found any other to be needed. Well, poll, maybe, but with
  only minor tweaks for the win32 one works for me (and those tweaks are
  compatible with win32
 
  A separate file, compat/tandem/mkdir.c, is fine, though.
 
 If you wouldn't have dozens of them, so compat/tandem/mkdir.c is not
suitable;
 compat/tandem.c would be good, then.
 
   I'll go for git_mkdir(), similar to other git wrappers, (like for
   mmap, pread, fopen, snprintf, vsnprintf, qsort).
 
  Again, no.  Your breakage is that having underlying system mkdir that
  does
  not
  understand trailing slash, which may not be specific to __TANDEM, but
  still is
  _not_ the only possible mode of breakage.

True.

  Well, it is the only one GNUlib's mkdir caters for and I'd regard that
  an authoritative source...
 
 I suspect that you may be misunderstanding what compat/ is about

I don't think so, it server the same purpose for git as gnulib does for
others.

, so let's try again.
 Platform difference in mkdir may not be limited to on this platform, the
 underlying one supplied by the system does not like path ending with a
slash.
 
 What I am saying is that it is unacceptable to call something that caters
to that
 specific kind of difference from what the codebase expects with a generic
 name such as git_mkdir().  Look at mingw's replacement.  The platform
 difference over there is that the one from the system does not take mode
 parameter.  Imagine that one was already called git_mkdir().  Now we
have
 two different kind of differences, and one has more officially-looking
 git_mkdir() name; yours cannot take it---what would you do in that case?
 Neither kind of difference is more officially sanctioned difference; don't
call
 yours any more official/generic than necessary.

Gnulib's rpl_mkdir caters for 3 possible problems, the WIN32 one which mkdir
taking only one argument, the trailing slash one discussed here (victims
being at least NetBSD 1.5.2 and current HP NonStop) and a trailing dot one
(that allegedly Cygwin 1.5 suffered from).

As far as I can see git will not suffer from the latter, but even if, at
that time a git_mkdir() could be expanded to cater for this to, just like
gnulib's one does, there it is an additional section inside their
rpl_mkdir().
And the WIN32 one is already being taken care of in compat/mingw.h. However,
this could as easily get integrated into 
a git_mkdir(), just like in gnulib.

 Your wrapper is not limited to tandem, but is applicable to ancient BSDs,
so it is
 fine to call it as compat_mkdir_wo_trailing_slash(), so that it can be
shared
 among platforms whose mkdir do not want to see trailing slashes.  If you
are
 going that route, the function should live in its own file (without any
other
 wrapper), and not be named after specific platform (should be named after
the
 specific difference from what we expect, instead).  I am perfectly fine
with that
 approach as well.
 
  Squatting on a generic git_mkdir() name makes it harder for other
  people
  to
  name their compat mkdir functions to tweak for the breakage on their
  platforms.  The examples you listed are all the platform does not
  offer
  it, so
  we implement the whole thing kind, so it is in a different genre.
 
  Nope, git_fopen() definitly is a wrapper for fopen(), as is
  git_vsnprintf() for vsnprintf().
 
 I was talking more about mmap() and pread().
 
 For the two you mentioned, ideally they should have been named after the
 specific breakages they cover (fopen that does not error out on
directories is
 primarily AIX thing IIRC, and snprintf returns bogus result are shared
between
 HPUX and Windows), but over these years we haven't seen any other kind of
 differences from various platforms, so the need to rename them away is
very
 low.
 
 On the other hand, we already know there are at least two kinds of
platform
 mkdir() that need different compat/ layer support, so calling one
git_mkdir()
 to cover one particular kind of difference does not make any sense.
 
 Besides, an earlier mistake is not a valid excuse to add new mistakes.

OK, so how about this:
/usr/local/bin/diff -EBbu ./compat/mkdir.c.orig ./compat/mkdir.c
--- ./compat/mkdir.c.orig   2012-08-21 05:02:11 -0500
+++ ./compat/mkdir.c2012-08-21 05:02:11 -0500
@@ -0,0 +1,24 @@
+#include ../git-compat-util.h
+#undef mkdir
+
+/* for platforms that can't deal with a trailing '/' */
+int compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode)
+{
+   int retval;
+   char *tmp_dir = NULL;
+   size_t len = strlen(dir);
+
+   if (len  dir[len-1] == '/') {
+   if ((tmp_dir = strdup(dir)) == NULL)
+   return -1;
+   tmp_dir[len-1] = '\0';
+   }
+

RE: git on HP NonStop

2012-08-22 Thread Joachim Schmitz


 -Original Message-
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Tuesday, August 21, 2012 4:06 AM
 To: Joachim Schmitz
 Cc: 'Johannes Sixt'; 'Jan Engelhardt'; git@vger.kernel.org
 Subject: Re: git on HP NonStop
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  OK, so let's have a look at code, current git, builtin/cat-file.c,
  line 196:
  void *contents = contents;
 
  This variable is set later in an if branch (if (print_contents ==
  BATCH), but not in the else branch. It is later used always under the
  same condition as the one under which it is set.
  Apparently is is malloc_d storage (there a free(content);), so
  there's no harm al all in initializing it with NULL, even if it only
  appeases a stupid compiler.
 
 It actually is harmful.  See below.

Harmful to initialize with NULL or to use that undefined behavoir?

I checked what our compiler does here: after having warned about vlues us
used before it is set: it actually dies seem to have initializes the value
to 0 resp. NULL.
So here there's no harm done in avoiding undefined behavior and set it to 0
resp NULL in the first place.

  The next one, builtin/fast-export.c, line 486:
  struct commit *commit = commit; it is set in a switch
  statement, but not in every case, as far as I can see.
  Hmm, maybe it is, and I just get lost in the code And it is used
  directly after the switch, hopefully set to something reasonable.
  Why take the risk and not set it to NULL?
 
 Ditto.
 
  Next one, builtin/rev-list.c, line 390:
  int reaches = reaches, all = all;
 
  revs.commits = find_bisection(revs.commits, reaches,
all,
bisect_find_all);
 
  Seem pretty pointless to initialize them, provided find_bisection
  doesn't read them. Does it?
 
 That is why they are not initializations but marks to the compiler to
signal you
 may be stupid enough to think they are used before initialized or
assigned, but
 that is not the case.  Initializing them would be pointless.
 
  Next one, fast-import.c, line 2268:
  struct object_entry *oe = oe;
 
  os gets set in en if and an else branch, but not in then intermediate
  else if branch!
 
 Look again.  If the recent code is too complex for you to understand, go
back to
 10e8d68 (Correct compiler warnings in fast-import., 2007-02-06) and read
the
 function.
 
 The control flow of the early part of that function dictates that either
oe is
 assigned *or* inline_data is set to 1.  When inline_data is false, oe is
always
 set.
 
 The compiler was too stupid to read that, and that is why the
 (confusing) idiom to mark it for the stupid compiler was used.
 
 There are a few reasons why I do not think this self-assignment idiom or
 initializing the variable to an innocuous-looking random value is a
particularly
 good thing to do when you see compiler warnings.
 
 If the compiler suspects the variable might be unused, you should always
look
 at it and follow the flow yourself.  Once you know it is a false alarm,
you can
 use the idiom to squelch the warning, and it at the same serves as a note
to
 others that you verified the flow and made sure it is a false warning.
 
 When the next person wants to touch the code, if the person knows the use
of
 the idiom, it only serves as a warning to be extra careful not to
introduce a new
 codepath that reads the variable without setting, as the compiler no
longer
 helps him.  If the person who touches the code is as clueless as the
compiler
 and cannot follow the codepath to see the variable is never used
uninitialized,
 the result will be a lot worse.
 
 That is the reason why I do not think the idiom to squelch the compiler is
such a
 good thing.  Careless people touch the code, so oe = oe initialization
carefully
 placed in the original version does not necessarily stay as a useful
 documentation.
 
 But if you use oe = NULL as a way to squelch the warning in the first
place, it
 is no better than oe = oe.  In a sense, it is even worse, as it just
looks like any
 other initialization and gives a false impression that the remainder of
the code
 is written in such a way that it tolerates oe being NULL in any codepath,
or
 there is some assignment before that before the code reaches places where
oe
 cannot be NULL.  That is different from what oe = oe initializaion
documents--
 -in the codepath protected by if (inline_data), it isn't just oe can
safely be
 NULL there; instead it is oe can safely be *any* value there, because we
don't
 use it.  Of course, if you explicitly initialized oe to NULL, even if you
introduce
 a codepath where oe cannot be NULL later, you won't get a warning from the
 compiler, so it is no better than oe = oe.
 
 And that is the reason why I do not think initialization to an
innocuous-looking
 random value (e.g. NULL) is a good answer, either.
 
 When both are not good, replacing oe = oe with oe = NULL didn't make
 much sense, 

Re: [PATCH] Support generate poison .mo files for testing

2012-08-22 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy  pclo...@gmail.com writes:

 +static void translate(const char *msg, struct strbuf *buf)
 +{
 + const char *end = msg + strlen(msg);
 + const char *text = * GETTEXT POISON *;
 + int text_len = strlen(text);
 + int t = 0;
 +
 + strbuf_reset(buf);
 + /* preserve \n and printf format specifiers because msgfmt
 +barfs otherwise. */
 + while (msg  end) {
 + /* printf specifiers and shell variables, it's a quite
 +relax check */
 + if ((*msg == '%' || *msg == '$')  msg+1  end) {
 + strbuf_addch(buf, *msg++);
 + do
 +strbuf_addch(buf, *msg);
 + while (msg  end  !isspace(*msg++));

Aside from the Style:

do {
...
} while ();

why are you special casing a run of non-blank letters that begin
with a dollar sign (swapping two ints is done with %2$d %1$d, a
percent still at the beginning, so there must be something else I am
missing)?

Also why do you stop at isspace()?  Isn't a   (space) a flag that
means If the first character of a signed conversion is not a sign
or if a signed conversion results in no characters, a space shall
be prefixed to the result.

As the flags, min-width, precision, and length do not share the same
character as the conversion that has to come at the end, I think you
only want to do something like

/*
 * conversion specifier characters, taken from:
 * http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html
 */
static const char printf_conversion[] = diouxXfFeEgGaAcspnCS%;

...

while (msg  end) {
if (*msg == '%') {
strbuf_addch(buf, *msg++);
while (msg  end) {
int ch = *msg++;
strbuf_addch(buf, ch);
if (strchr(printf_conversion, ch))
break;
}
/* copied the printf part literally */
continue;
}
... keep \n ...
... muck with string ...
}

perhaps?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Get ciabot configuration from git variables.

2012-08-22 Thread Junio C Hamano
Thanks, will update 'maint' with it.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] fetch/push: allow refs/*:refs/*

2012-08-22 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes:

 Michael Haggerty mhag...@alum.mit.edu writes:
 ...
 * The second branch of the if is *never* executed.
   else if (args.fetch_all 
(!args.depth || prefixcmp(ref-name, refs/tags/) )) {
   *newtail = ref;
   ref-next = NULL;
   newtail = ref-next;
   continue;
   }

 I am not familiar with (nor particularly interested in) the args.depth
 code, so I have no comment on this part offhand.

This is fetch --all case.  I think the original intent was to
fetch all branches (hence exclusion of tags) so the prefixcmp() may
not be correct (!prefixcmp() with refs/heads would be more kosher)
these days.  I am not sure what !args.depth check wants to do here
(that is, I can see it wants to defeat fetch --all and instead
make it go through the usual refspec matching codepath, but I do not
know why we thought that is a good thing to do here).



--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Q] Comparing differences introduced by two commits?

2012-08-22 Thread Junio C Hamano
Jonathan del Strother maill...@steelskies.com writes:

 On 22 August 2012 13:10, Brian Foster brian.fos...@maxim-ic.com wrote:
 ...
  In the past I've done:

 diff (git show A) (git show B)

  which produces rather messy output but is Ok when dealing
  with just one or two sets of A/B commits.  I now have a
  large-ist set of A/B commits, and the above is impractical.

Isn't this what interdiff is for?

  Some searching hasn't found any suggestions I'm too happy
  with, albeit I've very possibly overlooked something.

 What about cherry picking B onto A, then showing the cherry-picked commit?

 Off the top of my head :

 git checkout A
 git cherry-pick B
 git show HEAD

Wouldn't you see a lot of needless conflicts while doing such a cherry-pick?

I often do

git checkout A^
git cherry-pick B
git diff A

when queuing an updated patch.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Brandon Casey
On Wed, Aug 22, 2012 at 9:30 AM, Joachim Schmitz
j...@schmitz-digital.de wrote:

 OK, so how about this:
 /usr/local/bin/diff -EBbu ./compat/mkdir.c.orig ./compat/mkdir.c
 --- ./compat/mkdir.c.orig   2012-08-21 05:02:11 -0500
 +++ ./compat/mkdir.c2012-08-21 05:02:11 -0500
 @@ -0,0 +1,24 @@
 +#include ../git-compat-util.h
 +#undef mkdir
 +
 +/* for platforms that can't deal with a trailing '/' */
 +int compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode)
 +{
 +   int retval;
 +   char *tmp_dir = NULL;
 +   size_t len = strlen(dir);
 +
 +   if (len  dir[len-1] == '/') {
 +   if ((tmp_dir = strdup(dir)) == NULL)
 +   return -1;
 +   tmp_dir[len-1] = '\0';
 +   }
 +   else
 +   tmp_dir = (char *)dir;
 +
 +   retval = mkdir(tmp_dir, mode);
 +   if (tmp_dir != dir)
 +   free(tmp_dir);
 +
 +   return retval;
 +}

Why not rearrange this so that you assign to dir the value of tmp_dir
and then just pass dir to mkdir.  Then you can avoid the recast of dir
to (char*) in the else branch.  Later, just call free(tmp_dir).  Also,
we have xstrndup.  So I think the body of your function can become
something like:

   if (len  dir[len-1] == '/')
   dir = tmp_dir = xstrndup(dir, len-1);

   retval = mkdir(dir, mode);
   free(tmp_dir);

-Brandon
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
 ---
  Makefile| 18 ++
  compat/win32/poll.c |  8 ++--
  2 files changed, 20 insertions(+), 6 deletions(-)

 diff --git a/Makefile b/Makefile
 index 6b0c961..2af4db3 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -152,6 +152,11 @@ all::
  #
  # Define NO_MMAP if you want to avoid mmap.
  #
 +# Define NO_SYS_POLL_H if you don't have sys/poll.h.
 +#
 +# Define NO_POLL if you do not have or do not want to use poll.
 +# This also implies NO_SYS_POLL_H.

Do you really need to have both?  I suspect If you do not have a
usable sys/poll.h, set NO_SYS_POLL_H may be a simpler alternative,
but there must be a reason why you had to add a new one instead of
going that route.  It would be a good idea to describe that reason
in the log message above, in the space before your Sign-off.

 @@ -1257,7 +1262,7 @@ ifeq ($(uname_S),Windows)
 BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild
 -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H
 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
 COMPAT_OBJS = compat/msvc.o compat/winansi.o \
 compat/win32/pthread.o compat/win32/syslog.o \
 -   compat/win32/poll.o compat/win32/dirent.o
 +   compat/win32/dirent.o
 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H
 ...
 @@ -1347,7 +1352,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\.exe\
 COMPAT_OBJS += compat/mingw.o compat/winansi.o \
 compat/win32/pthread.o compat/win32/syslog.o \
 -   compat/win32/poll.o compat/win32/dirent.o
 +   compat/win32/dirent.o
 EXTLIBS += -lws2_32
 ...
 @@ -1601,6 +1606,11 @@ ifdef NO_GETTEXT
 ...
 +ifdef NO_POLL
 +   NO_SYS_POLL_H = YesPlease
 +   COMPAT_CFLAGS += -DNO_POLL -Icompat/win32 # so it find poll.h
 +   COMPAT_OBJS += compat/win32/poll.c
 +endif

In general, I think this is a good direction to go.  If the existing
emulation in win32/poll.c turns out to be usable across platforms
and not windows specific, sharing it would be a good idea.

But if the emulation is no longer windows specific, shouldn't you
also move it outside compat/win32/ and somewhere more generic?

 diff --git a/compat/win32/poll.c b/compat/win32/poll.c
 index 403eaa7..49541f1 100644
 --- a/compat/win32/poll.c
 +++ b/compat/win32/poll.c
 @@ -24,7 +24,9 @@
  # pragma GCC diagnostic ignored -Wtype-limits
  #endif

 -#include malloc.h
 +#if defined(WIN32)
 +# include malloc.h
 +#endif

Hrm, are the Windows folks OK with this?  MINGW and MSVC are
affected; Cygwin should be OK, I think.

  #include sys/types.h

 @@ -48,7 +50,9 @@
  #else
  # include sys/time.h
  # include sys/socket.h
 -# include sys/select.h
 +# ifndef NO_SYS_SELECT_H
 +#  include sys/select.h
 +# endif
  # include unistd.h
  #endif
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Brandon Casey
On Wed, Aug 22, 2012 at 10:00 AM, Brandon Casey draf...@gmail.com wrote:
 Also, we have xstrndup.  So I think the body of your function can become
 something like:

if (len  dir[len-1] == '/')
dir = tmp_dir = xstrndup(dir, len-1);

retval = mkdir(dir, mode);
free(tmp_dir);

Actually, xmemdupz could be used in place of xstrndup since we've
already called strlen.

-Brandon
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Porting git to HP NonStop

2012-08-22 Thread Joachim Schmitz
 From: Brandon Casey [mailto:draf...@gmail.com]
 Sent: Wednesday, August 22, 2012 7:01 PM
 To: Joachim Schmitz
 Cc: Junio C Hamano; Shawn Pearce; git@vger.kernel.org;
 rsbec...@nexbridge.com
 Subject: Re: Porting git to HP NonStop
 
 On Wed, Aug 22, 2012 at 9:30 AM, Joachim Schmitz j...@schmitz-digital.de
 wrote:
 
  OK, so how about this:
  /usr/local/bin/diff -EBbu ./compat/mkdir.c.orig ./compat/mkdir.c
  --- ./compat/mkdir.c.orig   2012-08-21 05:02:11 -0500
  +++ ./compat/mkdir.c2012-08-21 05:02:11 -0500
  @@ -0,0 +1,24 @@
  +#include ../git-compat-util.h
  +#undef mkdir
  +
  +/* for platforms that can't deal with a trailing '/' */ int
  +compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode) {
  +   int retval;
  +   char *tmp_dir = NULL;
  +   size_t len = strlen(dir);
  +
  +   if (len  dir[len-1] == '/') {
  +   if ((tmp_dir = strdup(dir)) == NULL)
  +   return -1;
  +   tmp_dir[len-1] = '\0';
  +   }
  +   else
  +   tmp_dir = (char *)dir;
  +
  +   retval = mkdir(tmp_dir, mode);
  +   if (tmp_dir != dir)
  +   free(tmp_dir);
  +
  +   return retval;
  +}
 
 Why not rearrange this so that you assign to dir the value of tmp_dir and then
 just pass dir to mkdir.  Then you can avoid the recast of dir to (char*) in 
 the
 else branch.  Later, just call free(tmp_dir).  Also, we have xstrndup.  So I 
 think
 the body of your function can become something like:
 
if (len  dir[len-1] == '/')
dir = tmp_dir = xstrndup(dir, len-1);

xstndup() can't fail?
 
retval = mkdir(dir, mode);
free(tmp_dir);
 
 -Brandon

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 Signed-off-by: Joachim Schmitz j...@schmitz-digital.de

At the very least, please mention that this reverts be22d92 (http:
avoid empty error messages for some curl errors, 2011-09-05) on
platforms with older versions of libcURL.

 ---
  http.c | 2 ++
  1 file changed, 2 insertions(+)

 diff --git a/http.c b/http.c
 index b61ac85..18bc6bf 100644
 --- a/http.c
 +++ b/http.c
 @@ -806,10 +806,12 @@ static int http_request(const char *url, void *result,
 int target, int options)
 ret = HTTP_REAUTH;
 }
 } else {
 +#if LIBCURL_VERSION_NUM = 0x070c00
 if (!curl_errorstr[0])
 strlcpy(curl_errorstr,
  
 curl_easy_strerror(results.curl_result),
 sizeof(curl_errorstr));
 +#endif
 ret = HTTP_ERROR;
 }
 } else {
 --
 1.7.12

 Bye, Jojo
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Prefer sysconf(_SC_OPEN_MAX) over getrlimit(RLIMIT_NOFILE,...)

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
 ---
  sha1_file.c | 4 
  1 file changed, 4 insertions(+)

 diff --git a/sha1_file.c b/sha1_file.c
 index af5cfbd..76714ad 100644
 --- a/sha1_file.c
 +++ b/sha1_file.c
 @@ -747,6 +747,9 @@ static int open_packed_git_1(struct packed_git *p)
 return error(packfile %s index unavailable, p-pack_name);

 if (!pack_max_fds) {
 +#ifdef _SC_OPEN_MAX
 +   unsigned int max_fds = sysconf(_SC_OPEN_MAX);
 +#else
 struct rlimit lim;
 unsigned int max_fds;

 @@ -754,6 +757,7 @@ static int open_packed_git_1(struct packed_git *p)
 die_errno(cannot get RLIMIT_NOFILE);

 max_fds = lim.rlim_cur;
 +#endif

 /* Save 3 for stdin/stdout/stderr, 22 for work */
 if (25  max_fds)
 --
 1.7.12

Looks sane but it would be more readable to make this a small helper
function, so that we do not need to have #ifdef/#endif in the
primary flow of the code.

By the way, I noticed that you seem to be sending patches out of
git, instead of diff -ru, which is a good sign ;-).  But all of
your patches are whitespace damaged and cannot be applied X-.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Brandon Casey
On Wed, Aug 22, 2012 at 10:18 AM, Joachim Schmitz
j...@schmitz-digital.de wrote:
 From: Brandon Casey [mailto:draf...@gmail.com]
 Sent: Wednesday, August 22, 2012 7:01 PM
 To: Joachim Schmitz
 Cc: Junio C Hamano; Shawn Pearce; git@vger.kernel.org;
 rsbec...@nexbridge.com
 Subject: Re: Porting git to HP NonStop

 On Wed, Aug 22, 2012 at 9:30 AM, Joachim Schmitz j...@schmitz-digital.de
 wrote:

  OK, so how about this:
  /usr/local/bin/diff -EBbu ./compat/mkdir.c.orig ./compat/mkdir.c
  --- ./compat/mkdir.c.orig   2012-08-21 05:02:11 -0500
  +++ ./compat/mkdir.c2012-08-21 05:02:11 -0500
  @@ -0,0 +1,24 @@
  +#include ../git-compat-util.h
  +#undef mkdir
  +
  +/* for platforms that can't deal with a trailing '/' */ int
  +compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode) {
  +   int retval;
  +   char *tmp_dir = NULL;
  +   size_t len = strlen(dir);
  +
  +   if (len  dir[len-1] == '/') {
  +   if ((tmp_dir = strdup(dir)) == NULL)
  +   return -1;
  +   tmp_dir[len-1] = '\0';
  +   }
  +   else
  +   tmp_dir = (char *)dir;
  +
  +   retval = mkdir(tmp_dir, mode);
  +   if (tmp_dir != dir)
  +   free(tmp_dir);
  +
  +   return retval;
  +}

 Why not rearrange this so that you assign to dir the value of tmp_dir and 
 then
 just pass dir to mkdir.  Then you can avoid the recast of dir to (char*) in 
 the
 else branch.  Later, just call free(tmp_dir).  Also, we have xstrndup.  So I 
 think
 the body of your function can become something like:

if (len  dir[len-1] == '/')
dir = tmp_dir = xstrndup(dir, len-1);

 xstndup() can't fail?

Correct.  It will either succeed or die.  It will also try to free up
some memory used by git if possible.

-Brandon
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: What's cooking in git.git (Aug 2012, #06; Tue, 21)

2012-08-22 Thread Junio C Hamano
Nguyen Thai Ngoc Duy pclo...@gmail.com writes:

 On Wed, Aug 22, 2012 at 6:10 AM, Junio C Hamano gits...@pobox.com wrote:
 * nd/i18n-parseopt-help (2012-08-20) 54 commits
  - i18n: shortlog: mark parseopt strings for translation
 ...
  - i18n: mark style in OPT_COLUMN() for translation

 A lot of i18n mark-up for the help text from git cmd -h.

 It's a 66 patch series, but only 54 here. 55/66 [1] to 66/66 [2] did
 not make it to your inbox?

 [1] http://article.gmane.org/gmane.comp.version-control.git/203827
 [2] http://article.gmane.org/gmane.comp.version-control.git/203838

I do recall discarding one (the one about _( tracked)), but
otherwise no I didn't throw anything else away on purpose.

Let me recheck.  Thanks for letting me know.


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Joachim Schmitz
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 7:19 PM
 To: Joachim Schmitz
 Cc: git@vger.kernel.org
 Subject: Re: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
 
 At the very least, please mention that this reverts be22d92 (http:
 avoid empty error messages for some curl errors, 2011-09-05) on platforms
 with older versions of libcURL.

a) Of course I didn't know that, thanks for telling me.
b) How and where to add that? In the Subject of an email, in the body, right
at the front?
Like this:


This reverts be22d92 (http: avoid empty error messages for some curl errors,
2011-09-05) on platforms with older versions of libcURL.

Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
---
 http.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/http.c b/http.c
index b61ac85..18bc6bf 100644
--- a/http.c
+++ b/http.c
@@ -806,10 +806,12 @@ static int http_request(const char *url, void *result,
int target, int options)
ret = HTTP_REAUTH;
}
} else {
+#if LIBCURL_VERSION_NUM = 0x070c00
if (!curl_errorstr[0])
strlcpy(curl_errorstr,
 
curl_easy_strerror(results.curl_result),
sizeof(curl_errorstr));
+#endif
ret = HTTP_ERROR;
}
} else {
--
1.7.12

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Junio C Hamano
Brandon Casey draf...@gmail.com writes:

 On Wed, Aug 22, 2012 at 9:30 AM, Joachim Schmitz
 j...@schmitz-digital.de wrote:

 OK, so how about this:
 /usr/local/bin/diff -EBbu ./compat/mkdir.c.orig ./compat/mkdir.c
 --- ./compat/mkdir.c.orig   2012-08-21 05:02:11 -0500
 +++ ./compat/mkdir.c2012-08-21 05:02:11 -0500
 @@ -0,0 +1,24 @@
 +#include ../git-compat-util.h
 +#undef mkdir
 +
 +/* for platforms that can't deal with a trailing '/' */
 +int compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode)
 +{
 +   int retval;
 +   char *tmp_dir = NULL;
 +   size_t len = strlen(dir);
 + ...
 Why not rearrange this so that you assign to dir the value of tmp_dir
 and then just pass dir to mkdir.  Then you can avoid the recast of dir
 to (char*) in the else branch.  Later, just call free(tmp_dir).  Also,
 we have xstrndup.  So I think the body of your function can become
 something like:

if (len  dir[len-1] == '/')
dir = tmp_dir = xstrndup(dir, len-1);

retval = mkdir(dir, mode);
free(tmp_dir);

Nice.  And we have xmemdupz() would be even better as you
followed-up.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Porting git to HP NonStop

2012-08-22 Thread Joachim Schmitz
 From: Brandon Casey [mailto:draf...@gmail.com]
 Sent: Wednesday, August 22, 2012 7:23 PM
 To: Joachim Schmitz
 Cc: Junio C Hamano; Shawn Pearce; git@vger.kernel.org;
 rsbec...@nexbridge.com
 Subject: Re: Porting git to HP NonStop
 
 On Wed, Aug 22, 2012 at 10:18 AM, Joachim Schmitz j...@schmitz-digital.de
 wrote:
  From: Brandon Casey [mailto:draf...@gmail.com]
  Sent: Wednesday, August 22, 2012 7:01 PM
  To: Joachim Schmitz
  Cc: Junio C Hamano; Shawn Pearce; git@vger.kernel.org;
  rsbec...@nexbridge.com
  Subject: Re: Porting git to HP NonStop
 
  On Wed, Aug 22, 2012 at 9:30 AM, Joachim Schmitz
  j...@schmitz-digital.de
  wrote:
 
   OK, so how about this:
   /usr/local/bin/diff -EBbu ./compat/mkdir.c.orig ./compat/mkdir.c
   --- ./compat/mkdir.c.orig   2012-08-21 05:02:11 -0500
   +++ ./compat/mkdir.c2012-08-21 05:02:11 -0500
   @@ -0,0 +1,24 @@
   +#include ../git-compat-util.h
   +#undef mkdir
   +
   +/* for platforms that can't deal with a trailing '/' */ int
   +compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode) {
   +   int retval;
   +   char *tmp_dir = NULL;
   +   size_t len = strlen(dir);
   +
   +   if (len  dir[len-1] == '/') {
   +   if ((tmp_dir = strdup(dir)) == NULL)
   +   return -1;
   +   tmp_dir[len-1] = '\0';
   +   }
   +   else
   +   tmp_dir = (char *)dir;
   +
   +   retval = mkdir(tmp_dir, mode);
   +   if (tmp_dir != dir)
   +   free(tmp_dir);
   +
   +   return retval;
   +}
 
  Why not rearrange this so that you assign to dir the value of tmp_dir
  and then just pass dir to mkdir.  Then you can avoid the recast of
  dir to (char*) in the else branch.  Later, just call free(tmp_dir).
  Also, we have xstrndup.  So I think the body of your function can become
 something like:
 
 if (len  dir[len-1] == '/')
 dir = tmp_dir = xstrndup(dir, len-1);
 
  xstndup() can't fail?
 
 Correct.  It will either succeed or die.  It will also try to free up some 
 memory
 used by git if possible.

OK. So let's use that then.

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Document the --done option.

2012-08-22 Thread Junio C Hamano
Eric S. Raymond e...@thyrsus.com writes:

 ---

A forgotten Sign-off?

Sverre, the text matches my understanding as well as what be56862
(fast-import: introduce 'done' command, 2011-07-16) says it did.
Ack?

  Documentation/git-fast-import.txt |8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

 diff --git a/Documentation/git-fast-import.txt 
 b/Documentation/git-fast-import.txt
 index 2620d28..9291ea0 100644
 --- a/Documentation/git-fast-import.txt
 +++ b/Documentation/git-fast-import.txt
 @@ -39,6 +39,10 @@ OPTIONS
   See ``Date Formats'' below for details about which formats
   are supported, and their syntax.
  
 +-- done::
 + Terminate with error if there is no 'done' command at the 
 + end of the stream.
 +
  --force::
   Force updating modified existing branches, even if doing
   so would cause commits to be lost (as the new commit does
 @@ -1047,7 +1051,9 @@ done::
   Error out if the stream ends without a 'done' command.
   Without this feature, errors causing the frontend to end
   abruptly at a convenient point in the stream can go
 - undetected.
 + undetected.  This may occur, for example, if an import
 + front end dies in mid-operation without emitting SIGTERM
 + or SIGKILL at its subordinate git fast-import instance.
  
  `option`
  
 -- 
 1.7.9.5
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 Like this:
 

 This reverts be22d92 (http: avoid empty error messages for some curl errors,
 2011-09-05) on platforms with older versions of libcURL.

 Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
 ---

Perfect ;-)

  http.c | 2 ++
  1 file changed, 2 insertions(+)

 diff --git a/http.c b/http.c
 index b61ac85..18bc6bf 100644
 --- a/http.c
 +++ b/http.c
 @@ -806,10 +806,12 @@ static int http_request(const char *url, void *result,
 int target, int options)
 ret = HTTP_REAUTH;
 }

Now we need to see where these whitespace breakages are coming from
and fix it, and I think it should be done earlier than later, as I
expect we will be seeing more patches from you in the coming weeks.

 } else {
 +#if LIBCURL_VERSION_NUM = 0x070c00
 if (!curl_errorstr[0])
 strlcpy(curl_errorstr,
  
 curl_easy_strerror(results.curl_result),
 sizeof(curl_errorstr));
 +#endif
 ret = HTTP_ERROR;
 }
 } else {
 --
 1.7.12

 Bye, Jojo
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Johannes Sixt
Am 22.08.2012 19:00, schrieb Brandon Casey:
  So I think the body of [compat_mkdir] can become
 something like:
 
if (len  dir[len-1] == '/')
dir = tmp_dir = xstrndup(dir, len-1);

Don't use x* wrappers in the compat layer, at least not those that
allocate memory: They behave unpredictably due to try_to_free_routine
and may lead to recursive invocations.

 
retval = mkdir(dir, mode);
free(tmp_dir);

-- Hannes

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact

2012-08-22 Thread Joachim Schmitz
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 7:13 PM
 To: Joachim Schmitz
 Cc: git@vger.kernel.org; Erik Faye-Lund; Johannes Sixt; Marius Storm-Olsen
 Subject: Re: [PATCH] Support non-WIN32 system lacking poll() while keeping
 the WIN32 part intact
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
  ---
   Makefile| 18 ++
   compat/win32/poll.c |  8 ++--
   2 files changed, 20 insertions(+), 6 deletions(-)
 
  diff --git a/Makefile b/Makefile
  index 6b0c961..2af4db3 100644
  --- a/Makefile
  +++ b/Makefile
  @@ -152,6 +152,11 @@ all::
   #
   # Define NO_MMAP if you want to avoid mmap.
   #
  +# Define NO_SYS_POLL_H if you don't have sys/poll.h.
  +#
  +# Define NO_POLL if you do not have or do not want to use poll.
  +# This also implies NO_SYS_POLL_H.
 
 Do you really need to have both?  I suspect If you do not have a usable
 sys/poll.h, set NO_SYS_POLL_H may be a simpler alternative, but there
must

Hmm, Not having sys/poll.h and not having poll() are different thinks,
aren't they?

Using NO_SYS_POL_H so far only affects BASIC_CFLAGS:
ifdef NO_SYS_POLL_H
BASIC_CFLAGS += -DNO_SYS_POLL_H
endif

It does not add compat/win32/poll.c to COMPAT_OBJS, NO_POLL does that.

 be a reason why you had to add a new one instead of going that route.  It
would
 be a good idea to describe that reason in the log message above, in the
space
 before your Sign-off.
 
  @@ -1257,7 +1262,7 @@ ifeq ($(uname_S),Windows)
  BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild
  -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H
  -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
  COMPAT_OBJS = compat/msvc.o compat/winansi.o \
  compat/win32/pthread.o compat/win32/syslog.o \
  -   compat/win32/poll.o compat/win32/dirent.o
  +   compat/win32/dirent.o
  COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -
 DHAVE_STRING_H
  ...
  @@ -1347,7 +1352,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
  COMPAT_CFLAGS += -DSTRIP_EXTENSION=\.exe\
  COMPAT_OBJS += compat/mingw.o compat/winansi.o \
  compat/win32/pthread.o compat/win32/syslog.o \
  -   compat/win32/poll.o compat/win32/dirent.o
  +   compat/win32/dirent.o
  EXTLIBS += -lws2_32
  ...
  @@ -1601,6 +1606,11 @@ ifdef NO_GETTEXT ...
  +ifdef NO_POLL
  +   NO_SYS_POLL_H = YesPlease
  +   COMPAT_CFLAGS += -DNO_POLL -Icompat/win32 # so it find poll.h
  +   COMPAT_OBJS += compat/win32/poll.c endif
 
 In general, I think this is a good direction to go.  If the existing
emulation in
 win32/poll.c turns out to be usable across platforms and not windows
specific,
 sharing it would be a good idea.
 
 But if the emulation is no longer windows specific, shouldn't you also
move it
 outside compat/win32/ and somewhere more generic?

Should be possible. Esp. as with the current setup make issues a warning:

Makefile:2329: target `compat/win32/poll.c' doesn't match the target pattern

Haven't yet been able to spot where that comes from.

  diff --git a/compat/win32/poll.c b/compat/win32/poll.c index
  403eaa7..49541f1 100644
  --- a/compat/win32/poll.c
  +++ b/compat/win32/poll.c
  @@ -24,7 +24,9 @@
   # pragma GCC diagnostic ignored -Wtype-limits
   #endif
 
  -#include malloc.h
  +#if defined(WIN32)
  +# include malloc.h
  +#endif
 
 Hrm, are the Windows folks OK with this?  MINGW and MSVC are affected;
 Cygwin should be OK, I think.

I stole that define from another place in git (compat/nedmalloc/nedmalloc.c
line 36), there too it was used to hide malloc.h, so I assumed it to be
the proper method?
 
   #include sys/types.h
 
  @@ -48,7 +50,9 @@
   #else
   # include sys/time.h
   # include sys/socket.h
  -# include sys/select.h
  +# ifndef NO_SYS_SELECT_H
  +#  include sys/select.h
  +# endif
   # include unistd.h
   #endif

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 Do you really need to have both?  I suspect If you do not have a usable
 sys/poll.h, set NO_SYS_POLL_H may be a simpler alternative, but there
 must

 Hmm, Not having sys/poll.h and not having poll() are different thinks,
 aren't they?

Ahh, OK, I forgot the other combination: working poll() but inclusion
of sys/poll.h is unnecessary.  OK.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Document the --done option.

2012-08-22 Thread Sverre Rabbelier
On Wed, Aug 22, 2012 at 10:38 AM, Junio C Hamano gits...@pobox.com wrote:
 Eric S. Raymond e...@thyrsus.com writes:

 ---

 A forgotten Sign-off?

 Sverre, the text matches my understanding as well as what be56862
 (fast-import: introduce 'done' command, 2011-07-16) says it did.
 Ack?

Acked-by: Sverre Rabbelier srabbel...@gmail.com

-- 
Cheers,

Sverre Rabbelier
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Prefer sysconf(_SC_OPEN_MAX) over getrlimit(RLIMIT_NOFILE,...)

2012-08-22 Thread Joachim Schmitz
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 7:23 PM
 To: Joachim Schmitz
 Cc: git@vger.kernel.org
 Subject: Re: [PATCH] Prefer sysconf(_SC_OPEN_MAX) over
 getrlimit(RLIMIT_NOFILE,...)
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
  ---
   sha1_file.c | 4 
   1 file changed, 4 insertions(+)
 
  diff --git a/sha1_file.c b/sha1_file.c index af5cfbd..76714ad 100644
  --- a/sha1_file.c
  +++ b/sha1_file.c
  @@ -747,6 +747,9 @@ static int open_packed_git_1(struct packed_git *p)
  return error(packfile %s index unavailable,
  p-pack_name);
 
  if (!pack_max_fds) {
  +#ifdef _SC_OPEN_MAX
  +   unsigned int max_fds = sysconf(_SC_OPEN_MAX); #else
  struct rlimit lim;
  unsigned int max_fds;
 
  @@ -754,6 +757,7 @@ static int open_packed_git_1(struct packed_git *p)
  die_errno(cannot get RLIMIT_NOFILE);
 
  max_fds = lim.rlim_cur;
  +#endif
 
  /* Save 3 for stdin/stdout/stderr, 22 for work */
  if (25  max_fds)
  --
  1.7.12
 
 Looks sane but it would be more readable to make this a small helper
function,
 so that we do not need to have #ifdef/#endif in the primary flow of the
code.

Hmm, in compat/? Worth the effort fort hat single occrence?

 By the way, I noticed that you seem to be sending patches out of git,
instead of
 diff -ru, which is a good sign ;-).  

Not quite, I'm generating them with git format-patch origin, on the
NonStop machine, but can't send email from there (a) behind a firewall and
b) no email client available), so I copy/paste the resulting file into
Outlook.

But all of your patches are whitespace
 damaged and cannot be applied X-.

May well be Outlooks fault? How to solve?

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Q] Comparing differences introduced by two commits?

2012-08-22 Thread Jonathan del Strother
On 22 August 2012 17:58, Junio C Hamano gits...@pobox.com wrote:
 Jonathan del Strother maill...@steelskies.com writes:

 On 22 August 2012 13:10, Brian Foster brian.fos...@maxim-ic.com wrote:
 ...
  In the past I've done:

 diff (git show A) (git show B)

  which produces rather messy output but is Ok when dealing
  with just one or two sets of A/B commits.  I now have a
  large-ist set of A/B commits, and the above is impractical.

 Isn't this what interdiff is for?

  Some searching hasn't found any suggestions I'm too happy
  with, albeit I've very possibly overlooked something.

 What about cherry picking B onto A, then showing the cherry-picked commit?

 Off the top of my head :

 git checkout A
 git cherry-pick B
 git show HEAD

 Wouldn't you see a lot of needless conflicts while doing such a cherry-pick?

 I often do

 git checkout A^
 git cherry-pick B
 git diff A

 when queuing an updated patch.


True.  That sounds a better solution.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Joachim Schmitz
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 7:41 PM
 To: Joachim Schmitz
 Cc: git@vger.kernel.org
 Subject: Re: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  Like this:
  
 
  This reverts be22d92 (http: avoid empty error messages for some curl
  errors,
  2011-09-05) on platforms with older versions of libcURL.
 
  Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
  ---
 
 Perfect ;-)
 
   http.c | 2 ++
   1 file changed, 2 insertions(+)
 
  diff --git a/http.c b/http.c
  index b61ac85..18bc6bf 100644
  --- a/http.c
  +++ b/http.c
  @@ -806,10 +806,12 @@ static int http_request(const char *url, void
  *result, int target, int options)
  ret = HTTP_REAUTH;
  }
 
 Now we need to see where these whitespace breakages are coming from and
 fix it, and I think it should be done earlier than later, as I expect we
will be
 seeing more patches from you in the coming weeks.

OK, next attempt (this time I downloaded the patch file to my PC first and
used Wordpad for copy/past rather than cat in a PuTTY session)
---

This reverts be22d92 (http: avoid empty error messages for some curl errors,
2011-09-05) on platforms with older versions of libcURL.

Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
---
 http.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/http.c b/http.c
index b61ac85..18bc6bf 100644
--- a/http.c
+++ b/http.c
@@ -806,10 +806,12 @@ static int http_request(const char *url, void *result,
int target, int options)
ret = HTTP_REAUTH;
}
} else {
+#if LIBCURL_VERSION_NUM = 0x070c00
if (!curl_errorstr[0])
strlcpy(curl_errorstr,
 
curl_easy_strerror(results.curl_result),
sizeof(curl_errorstr));
+#endif
ret = HTTP_ERROR;
}
} else {
-- 
1.7.12

Better?

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Prefer sysconf(_SC_OPEN_MAX) over getrlimit(RLIMIT_NOFILE,...)

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 Looks sane but it would be more readable to make this a small helper
 function,
 so that we do not need to have #ifdef/#endif in the primary flow of the
 code.

 Hmm, in compat/? Worth the effort fort hat single occrence?

Compat/ is to have some systems that lack an interface we deem to be
common on platforms emulate that interface, but in this case, we
just want something like:

static int get_max_fd_limit(void)
{
#ifdef _SC_OPEN_MAX
...
#else
...
#endif
return max_fds;
}

and that is not emulating anybody's standard interface.

Such a helper before the definition of the function that your patch
is touching, in the same file as a file-scope static, was what I
meant.  If other places in the code want to open tons of pipes or
file descriptors for some reason, we may want to make it part of the
supporting infrastructure, and drop static  at the beginning and
add extern int get_max_fd_limit(void); to cache.h for others to
use, but as you said, there is currently only one place that uses
it, so it can stay static to the file.



--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Johannes Sixt
Am 22.08.2012 20:02, schrieb Joachim Schmitz:
 From: Johannes Sixt [mailto:j...@kdbg.org]
 Don't use x* wrappers in the compat layer, at least not those that allocate
 memory: They behave unpredictably due to try_to_free_routine and may lead
 to recursive invocations.
 
 I was just following orders ;-)
 What about the other proposal, xmemdupz? Same story I guess?

xmemdupz calls xmalloc, so, yes, same story.

-- Hannes

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Brandon Casey
On Wed, Aug 22, 2012 at 10:41 AM, Johannes Sixt j...@kdbg.org wrote:
 Am 22.08.2012 19:00, schrieb Brandon Casey:
  So I think the body of [compat_mkdir] can become
 something like:

if (len  dir[len-1] == '/')
dir = tmp_dir = xstrndup(dir, len-1);

 Don't use x* wrappers in the compat layer, at least not those that
 allocate memory: They behave unpredictably due to try_to_free_routine
 and may lead to recursive invocations.

I thought that rule only applied to die handlers.  i.e. don't use the
x* wrappers to allocate memory in a die handler like
compat/win32/syslog.c.  At least that's what I wrote in 040a6551 when
you pointed out this issue back then.

Admittedly, it could get pretty sticky trying to trace the die
handlers to ensure they don't invoke your new compat/ function.  So,
yeah, adopting this rule of not using x* wrappers that allocate memory
in compat/ generally seems like a good idea.

Should we also try to detect recursive invocation of die and friends?
In theory recursion could be triggered by any die handler that makes
use of a code path that calls an x* wrapper that allocates memory,
couldn't it?

-Brandon
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:


 This reverts be22d92 (http: avoid empty error messages for some curl errors,
 2011-09-05) on platforms with older versions of libcURL.

 Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
 ---
  http.c | 2 ++
  1 file changed, 2 insertions(+)

 diff --git a/http.c b/http.c
 index b61ac85..18bc6bf 100644
 --- a/http.c
 +++ b/http.c
 @@ -806,10 +806,12 @@ static int http_request(const char *url, void *result,
 int target, int options)

Likewrapped X-

   ret = HTTP_REAUTH;
   }
   } else {
 +#if LIBCURL_VERSION_NUM = 0x070c00
   if (!curl_errorstr[0])
   strlcpy(curl_errorstr,
  
 curl_easy_strerror(results.curl_result),
   sizeof(curl_errorstr));
 +#endif
   ret = HTTP_ERROR;
   }
   } else {
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Porting git to HP NonStop

2012-08-22 Thread Joachim Schmitz
 -Original Message-
 From: Johannes Sixt [mailto:j...@kdbg.org]
 Sent: Wednesday, August 22, 2012 8:09 PM
 To: Joachim Schmitz
 Cc: 'Brandon Casey'; 'Junio C Hamano'; 'Shawn Pearce'; git@vger.kernel.org;
 rsbec...@nexbridge.com
 Subject: Re: Porting git to HP NonStop
 
 Am 22.08.2012 20:02, schrieb Joachim Schmitz:
  From: Johannes Sixt [mailto:j...@kdbg.org] Don't use x* wrappers in
  the compat layer, at least not those that allocate
  memory: They behave unpredictably due to try_to_free_routine and may
  lead to recursive invocations.
 
  I was just following orders ;-)
  What about the other proposal, xmemdupz? Same story I guess?
 
 xmemdupz calls xmalloc, so, yes, same story.

So back to my original patch, using strdup, check the return value, etc.

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Brandon Casey
On Wed, Aug 22, 2012 at 11:09 AM, Brandon Casey draf...@gmail.com wrote:
 On Wed, Aug 22, 2012 at 10:41 AM, Johannes Sixt j...@kdbg.org wrote:

 Don't use x* wrappers in the compat layer, at least not those that
 allocate memory: They behave unpredictably due to try_to_free_routine
 and may lead to recursive invocations.

 I thought that rule only applied to die handlers.  i.e. don't use the
 x* wrappers to allocate memory in a die handler like
 compat/win32/syslog.c.  At least that's what I wrote in 040a6551 when
 you pointed out this issue back then.

 Admittedly, it could get pretty sticky trying to trace the die
 handlers to ensure they don't invoke your new compat/ function.  So,
 yeah, adopting this rule of not using x* wrappers that allocate memory
 in compat/ generally seems like a good idea.

 Should we also try to detect recursive invocation of die and friends?
 In theory recursion could be triggered by any die handler that makes
 use of a code path that calls an x* wrapper that allocates memory,
 couldn't it?

Perhaps something like:

diff --git a/usage.c b/usage.c
index a2a6678..2d0ff35 100644
--- a/usage.c
+++ b/usage.c
@@ -80,8 +80,15 @@ void NORETURN usage(const char *err)

 void NORETURN die(const char *err, ...)
 {
+   static int dying;
va_list params;

+   if (dying) {
+   fputs(fatal: recursion detected in die handler\n, stderr);
+   exit(128);
+   }
+   dying = 1;
+
va_start(params, err);
die_routine(err, params);
va_end(params);
@@ -89,11 +96,18 @@ void NORETURN die(const char *err, ...)

 void NORETURN die_errno(const char *fmt, ...)
 {
+   static int dying;
va_list params;
char fmt_with_err[1024];
char str_error[256], *err;
int i, j;

+   if (dying) {
+   fputs(fatal: recursion detected in die handler\n, stderr);
+   exit(128);
+   }
+   dying = 1;
+
err = strerror(errno);
for (i = j = 0; err[i]  j  sizeof(str_error) - 1; ) {
if ((str_error[j++] = err[i++]) != '%')

-Brandon
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 Nice.  And we have xmemdupz() would be even better as you followed-up.

 How's that one used?

I forgot that we frown upon use of any xallocate() wrapper in the
compat/ layer as J6t mentioned.

So probably something along these lines...

int retval;
char *dir_to_free = NULL;
size_t len = strlen(dir);

if (len  dir[len - 1] == '/') {
dir_to_free = malloc(len);
if (!dir_to_free) {
fprintf(stderr, malloc failed!\n);
exit(1);
}
memcpy(dir_to_free, dir, len - 1);
dir_to_free[len - 1] = '\0';
dir = dir_to_free;
}
retval = mkdir(dir, mode);
free(dir_to_free);
return retval;

It might be possible to for the error path to get away with
something like:

if (!dir_to_free)
return -1;

if we know the callers are prepared to see mkdir() failing with
ENOMEM, but that is not very likely.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Junio C Hamano
Brandon Casey draf...@gmail.com writes:

 On Wed, Aug 22, 2012 at 10:41 AM, Johannes Sixt j...@kdbg.org wrote:
 Am 22.08.2012 19:00, schrieb Brandon Casey:
  So I think the body of [compat_mkdir] can become
 something like:

if (len  dir[len-1] == '/')
dir = tmp_dir = xstrndup(dir, len-1);

 Don't use x* wrappers in the compat layer, at least not those that
 allocate memory: They behave unpredictably due to try_to_free_routine
 and may lead to recursive invocations.

 I thought that rule only applied to die handlers.  i.e. don't use the
 x* wrappers to allocate memory in a die handler like
 compat/win32/syslog.c.  At least that's what I wrote in 040a6551 when
 you pointed out this issue back then.

 Admittedly, it could get pretty sticky trying to trace the die
 handlers to ensure they don't invoke your new compat/ function.  So,
 yeah, adopting this rule of not using x* wrappers that allocate memory
 in compat/ generally seems like a good idea.

 Should we also try to detect recursive invocation of die and friends?

 In theory recursion could be triggered by any die handler that makes
 use of a code path that calls an x* wrapper that allocates memory,
 couldn't it?

Correct, but at that point we will end up dying anyway, so...
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 66/66] Use imperative form in help usage to describe an action

2012-08-22 Thread Drew Northup
On Mon, Aug 20, 2012 at 8:32 AM, Nguyễn Thái Ngọc Duy pclo...@gmail.com wrote:

 Signed-off-by: Nguyễn Thái Ngọc Duy pclo...@gmail.com
 ---
  My guts tell me this is correct, but my English foundation is shaking
  so I say change in the name of consistency!

Your gut is working just fine. I haven't attempted to apply the patch,
but the English changes check out just fine. It could be argued that
these all should have taken the imperative form from the beginning as
the user is directing the program to do something (perhaps vicariously
via the documentation).

The other perspective I can think of off hand is that the
documentation is describing what the program options do to the user (a
different audience)--which explains why the text wasn't in
imperative form to begin with.

-- 
-Drew Northup
--
As opposed to vegetable or mineral error?
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Junio C Hamano
Brandon Casey draf...@gmail.com writes:

 Perhaps something like:

 diff --git a/usage.c b/usage.c
 index a2a6678..2d0ff35 100644
 --- a/usage.c
 +++ b/usage.c
 @@ -80,8 +80,15 @@ void NORETURN usage(const char *err)

  void NORETURN die(const char *err, ...)
  {
 +   static int dying;
 va_list params;

 +   if (dying) {
 +   fputs(fatal: recursion detected in die handler\n, stderr);
 +   exit(128);
 +   }
 +   dying = 1;
 +
 va_start(params, err);
 die_routine(err, params);
 va_end(params);
 @@ -89,11 +96,18 @@ void NORETURN die(const char *err, ...)

  void NORETURN die_errno(const char *fmt, ...)
  {
 +   static int dying;
 va_list params;
 char fmt_with_err[1024];
 char str_error[256], *err;
 int i, j;

 +   if (dying) {
 +   fputs(fatal: recursion detected in die handler\n, stderr);
 +   exit(128);
 +   }
 +   dying = 1;
 +
 err = strerror(errno);
 for (i = j = 0; err[i]  j  sizeof(str_error) - 1; ) {
 if ((str_error[j++] = err[i++]) != '%')

With two function-scope static, you can go like this:

die()
- die_routine()
   - xsomething()
  - die_errno()
- die_routine()
   - xsomethingelse()
  - die() or die_errno()

Not that we probably care too deeply about, as at least we won't
infinitely recurse and die out of stack space.



--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Brandon Casey
On Wed, Aug 22, 2012 at 11:33 AM, Junio C Hamano gits...@pobox.com wrote:
 Brandon Casey draf...@gmail.com writes:

 Perhaps something like:

 diff --git a/usage.c b/usage.c
 index a2a6678..2d0ff35 100644
 --- a/usage.c
 +++ b/usage.c
 @@ -80,8 +80,15 @@ void NORETURN usage(const char *err)

  void NORETURN die(const char *err, ...)
  {
 +   static int dying;
 va_list params;

 +   if (dying) {
 +   fputs(fatal: recursion detected in die handler\n, stderr);
 +   exit(128);
 +   }
 +   dying = 1;
 +
 va_start(params, err);
 die_routine(err, params);
 va_end(params);
 @@ -89,11 +96,18 @@ void NORETURN die(const char *err, ...)

  void NORETURN die_errno(const char *fmt, ...)
  {
 +   static int dying;
 va_list params;
 char fmt_with_err[1024];
 char str_error[256], *err;
 int i, j;

 +   if (dying) {
 +   fputs(fatal: recursion detected in die handler\n, stderr);
 +   exit(128);
 +   }
 +   dying = 1;
 +
 err = strerror(errno);
 for (i = j = 0; err[i]  j  sizeof(str_error) - 1; ) {
 if ((str_error[j++] = err[i++]) != '%')

 With two function-scope static, you can go like this:

 die()
 - die_routine()
- xsomething()
   - die_errno()
 - die_routine()
- xsomethingelse()
   - die() or die_errno()

 Not that we probably care too deeply about, as at least we won't
 infinitely recurse and die out of stack space.

Yeah, I noticed that, but didn't think it was important or likely.
But there's no reason not to make dying a global.

-Brandon
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Joachim Schmitz


 -Original Message-
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 8:17 PM
 To: Joachim Schmitz
 Cc: git@vger.kernel.org
 Subject: Re: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
 
  This reverts be22d92 (http: avoid empty error messages for some curl
  errors,
  2011-09-05) on platforms with older versions of libcURL.
 
  Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
  ---
   http.c | 2 ++
   1 file changed, 2 insertions(+)
 
  diff --git a/http.c b/http.c
  index b61ac85..18bc6bf 100644
  --- a/http.c
  +++ b/http.c
  @@ -806,10 +806,12 @@ static int http_request(const char *url, void
  *result, int target, int options)
 
 Likewrapped X-

Any suggestion?

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Porting git to HP NonStop

2012-08-22 Thread Joachim Schmitz
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 8:25 PM
 To: Joachim Schmitz
 Cc: 'Brandon Casey'; 'Shawn Pearce'; git@vger.kernel.org;
 rsbec...@nexbridge.com
 Subject: Re: Porting git to HP NonStop
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  Nice.  And we have xmemdupz() would be even better as you followed-up.
 
  How's that one used?
 
 I forgot that we frown upon use of any xallocate() wrapper in the
compat/
 layer as J6t mentioned.
 
 So probably something along these lines...
 
   int retval;
   char *dir_to_free = NULL;
   size_t len = strlen(dir);
 
 if (len  dir[len - 1] == '/') {
   dir_to_free = malloc(len);
 if (!dir_to_free) {
   fprintf(stderr, malloc failed!\n);
   exit(1);
   }
 memcpy(dir_to_free, dir, len - 1);
 dir_to_free[len - 1] = '\0';
 dir = dir_to_free;
   }
   retval = mkdir(dir, mode);
   free(dir_to_free);
 return retval;

So why not just strdup? I stole the idea from gnulib...

int
rpl_mkdir (char const *dir, mode_t mode maybe_unused)
{
  int ret_val;
  char *tmp_dir;
  size_t len = strlen (dir);

  if (len  dir[len - 1] == '/')
{
  tmp_dir = strdup (dir);
  if (!tmp_dir)
{
  /* Rather than rely on strdup-posix, we set errno ourselves.  */
  errno = ENOMEM;
  return -1;
}
  strip_trailing_slashes (tmp_dir);
}
  else
{
  tmp_dir = (char *) dir;
}


They strip more than one trailing slash, but for git's purpose I believed
this to be too much overhead. Also the errno stuff doesn't seem to be really
needed IMHO. Same for the following code

#if FUNC_MKDIR_DOT_BUG
  /* Additionally, cygwin 1.5 mistakenly creates a directory d/./.  */
  {
char *last = last_component (tmp_dir);
if (*last == '.'  (last[1] == '\0'
 || (last[1] == '.'  last[2] == '\0')))
  {
struct stat st;
if (stat (tmp_dir, st) == 0)
  errno = EEXIST;
return -1;
  }
  }
#endif /* FUNC_MKDIR_DOT_BUG */

Then it goes on like mine:

  ret_val = mkdir (tmp_dir, mode);

  if (tmp_dir != dir)
free (tmp_dir);

  return ret_val;
}

Compare:
$ cat compat/mkdir.c
#include ../git-compat-util.h
#undef mkdir

/* for platforms that can't deal with a trailing '/' */
int compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode)
{
int retval;
char *tmp_dir = NULL;
size_t len = strlen(dir);

if (len  dir[len-1] == '/') {
if ((tmp_dir = strdup(dir)) == NULL)
return -1;
tmp_dir[len-1] = '\0';
}
else
tmp_dir = (char *)dir;

retval = mkdir(tmp_dir, mode);
if (tmp_dir != dir)
free(tmp_dir);

return retval;
}

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 01/16] GSOC remote-svn

2012-08-22 Thread Florian Achleitner
Another improved series with fixups by Junio, and a little by me.
Diff:
- fix inconsistend indent in Documentation/git-remote-helpers.txt
- remove trailing newline in Makefile
- fix argument list and usage of regenerate_marks(void) in remote-svn.c


[PATCH v6 01/16] Implement a remote helper for svn in C
[PATCH v6 02/16] Add git-remote-testsvn to Makefile
[PATCH v6 03/16] Add svndump_init_fd to allow reading dumps from
[PATCH v6 04/16] Add argv_array_detach and argv_array_free_detached
[PATCH v6 05/16] Connect fast-import to the remote-helper via pipe,
[PATCH v6 06/16] Add documentation for the 'bidi-import' capability
[PATCH v6 07/16] When debug==1, start fast-import with --stats
[PATCH v6 08/16] remote-svn, vcs-svn: Enable fetching to private
[PATCH v6 09/16] Allow reading svn dumps from files via file:// urls
[PATCH v6 10/16] vcs-svn: add fast_export_note to create notes
[PATCH v6 11/16] Create a note for every imported commit containing
[PATCH v6 12/16] remote-svn: Activate import/export-marks for
[PATCH v6 13/16] remote-svn: add incremental import
[PATCH v6 14/16] Add a svnrdump-simulator replaying a dump file for
[PATCH v6 15/16] remote-svn: add marks-file regeneration
[PATCH v6 16/16] Add a test script for remote-svn
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 01/16] Implement a remote helper for svn in C

2012-08-22 Thread Florian Achleitner
Enable basic fetching from subversion repositories. When processing
remote URLs starting with testsvn::, git invokes this remote-helper.
It starts svnrdump to extract revisions from the subversion repository
in the 'dump file format', and converts them to a git-fast-import stream
using the functions of vcs-svn/.

Imported refs are created in a private namespace at
refs/svn/remote-name/master.  The revision history is imported
linearly (no branch detection) and completely, i.e. from revision 0 to
HEAD.

The 'bidi-import' capability is used. The remote-helper expects data
from fast-import on its stdin. It buffers a batch of 'import' command
lines in a string_list before starting to process them.

Signed-off-by: Florian Achleitner florian.achleitner.2.6...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 remote-testsvn.c |  174 ++
 1 file changed, 174 insertions(+)
 create mode 100644 remote-testsvn.c

diff --git a/remote-testsvn.c b/remote-testsvn.c
new file mode 100644
index 000..ebe803b
--- /dev/null
+++ b/remote-testsvn.c
@@ -0,0 +1,174 @@
+#include cache.h
+#include remote.h
+#include strbuf.h
+#include url.h
+#include exec_cmd.h
+#include run-command.h
+#include vcs-svn/svndump.h
+#include notes.h
+#include argv-array.h
+
+static const char *url;
+static const char *private_ref;
+static const char *remote_ref = refs/heads/master;
+
+static int cmd_capabilities(const char *line);
+static int cmd_import(const char *line);
+static int cmd_list(const char *line);
+
+typedef int (*input_command_handler)(const char *);
+struct input_command_entry {
+   const char *name;
+   input_command_handler fn;
+   unsigned char batchable;/* whether the command starts or is 
part of a batch */
+};
+
+static const struct input_command_entry input_command_list[] = {
+   { capabilities, cmd_capabilities, 0 },
+   { import, cmd_import, 1 },
+   { list, cmd_list, 0 },
+   { NULL, NULL }
+};
+
+static int cmd_capabilities(const char *line) {
+   printf(import\n);
+   printf(bidi-import\n);
+   printf(refspec %s:%s\n\n, remote_ref, private_ref);
+   fflush(stdout);
+   return 0;
+}
+
+static void terminate_batch(void)
+{
+   /* terminate a current batch's fast-import stream */
+   printf(done\n);
+   fflush(stdout);
+}
+
+static int cmd_import(const char *line)
+{
+   int code;
+   int dumpin_fd;
+   unsigned int startrev = 0;
+   struct argv_array svndump_argv = ARGV_ARRAY_INIT;
+   struct child_process svndump_proc;
+
+   memset(svndump_proc, 0, sizeof(struct child_process));
+   svndump_proc.out = -1;
+   argv_array_push(svndump_argv, svnrdump);
+   argv_array_push(svndump_argv, dump);
+   argv_array_push(svndump_argv, url);
+   argv_array_pushf(svndump_argv, -r%u:HEAD, startrev);
+   svndump_proc.argv = svndump_argv.argv;
+
+   code = start_command(svndump_proc);
+   if (code)
+   die(Unable to start %s, code %d, svndump_proc.argv[0], code);
+   dumpin_fd = svndump_proc.out;
+
+   svndump_init_fd(dumpin_fd, STDIN_FILENO);
+   svndump_read(url, private_ref);
+   svndump_deinit();
+   svndump_reset();
+
+   close(dumpin_fd);
+   code = finish_command(svndump_proc);
+   if (code)
+   warning(%s, returned %d, svndump_proc.argv[0], code);
+   argv_array_clear(svndump_argv);
+
+   return 0;
+}
+
+static int cmd_list(const char *line)
+{
+   printf(? %s\n\n, remote_ref);
+   fflush(stdout);
+   return 0;
+}
+
+static int do_command(struct strbuf *line)
+{
+   const struct input_command_entry *p = input_command_list;
+   static struct string_list batchlines = STRING_LIST_INIT_DUP;
+   static const struct input_command_entry *batch_cmd;
+   /*
+* commands can be grouped together in a batch.
+* Batches are ended by \n. If no batch is active the program ends.
+* During a batch all lines are buffered and passed to the handler 
function
+* when the batch is terminated.
+*/
+   if (line-len == 0) {
+   if (batch_cmd) {
+   struct string_list_item *item;
+   for_each_string_list_item(item, batchlines)
+   batch_cmd-fn(item-string);
+   terminate_batch();
+   batch_cmd = NULL;
+   string_list_clear(batchlines, 0);
+   return 0;   /* end of the batch, continue reading 
other commands. */
+   }
+   return 1;   /* end of command stream, quit */
+   }
+   if (batch_cmd) {
+   if (prefixcmp(batch_cmd-name, line-buf))
+   die(Active %s batch interrupted by %s, 
batch_cmd-name, line-buf);
+   /* buffer batch lines */
+   string_list_append(batchlines, line-buf);
+

[PATCH v6 08/16] remote-svn, vcs-svn: Enable fetching to private refs

2012-08-22 Thread Florian Achleitner
The reference to update by the fast-import stream is hard-coded.  When
fetching from a remote the remote-helper shall update refs in a
private namespace, i.e. a private subdir of refs/.  This namespace is
defined by the 'refspec' capability, that the remote-helper advertises
as a reply to the 'capabilities' command.

Extend svndump and fast-export to allow passing the target ref.
Update svn-fe to be compatible.

Signed-off-by: Florian Achleitner florian.achleitner.2.6...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 contrib/svn-fe/svn-fe.c |2 +-
 test-svn-fe.c   |2 +-
 vcs-svn/fast_export.c   |4 ++--
 vcs-svn/fast_export.h   |2 +-
 vcs-svn/svndump.c   |   14 +++---
 vcs-svn/svndump.h   |2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/contrib/svn-fe/svn-fe.c b/contrib/svn-fe/svn-fe.c
index 35db24f..c796cc0 100644
--- a/contrib/svn-fe/svn-fe.c
+++ b/contrib/svn-fe/svn-fe.c
@@ -10,7 +10,7 @@ int main(int argc, char **argv)
 {
if (svndump_init(NULL))
return 1;
-   svndump_read((argc  1) ? argv[1] : NULL);
+   svndump_read((argc  1) ? argv[1] : NULL, refs/heads/master);
svndump_deinit();
svndump_reset();
return 0;
diff --git a/test-svn-fe.c b/test-svn-fe.c
index 83633a2..cb0d80f 100644
--- a/test-svn-fe.c
+++ b/test-svn-fe.c
@@ -40,7 +40,7 @@ int main(int argc, char *argv[])
if (argc == 2) {
if (svndump_init(argv[1]))
return 1;
-   svndump_read(NULL);
+   svndump_read(NULL, refs/heads/master);
svndump_deinit();
svndump_reset();
return 0;
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 1f04697..11f8f94 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -72,7 +72,7 @@ static char gitsvnline[MAX_GITSVN_LINE_LEN];
 void fast_export_begin_commit(uint32_t revision, const char *author,
const struct strbuf *log,
const char *uuid, const char *url,
-   unsigned long timestamp)
+   unsigned long timestamp, const char *local_ref)
 {
static const struct strbuf empty = STRBUF_INIT;
if (!log)
@@ -84,7 +84,7 @@ void fast_export_begin_commit(uint32_t revision, const char 
*author,
} else {
*gitsvnline = '\0';
}
-   printf(commit refs/heads/master\n);
+   printf(commit %s\n, local_ref);
printf(mark :%PRIu32\n, revision);
printf(committer %s %s@%s %ld +\n,
   *author ? author : nobody,
diff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h
index 8823aca..17eb13b 100644
--- a/vcs-svn/fast_export.h
+++ b/vcs-svn/fast_export.h
@@ -11,7 +11,7 @@ void fast_export_delete(const char *path);
 void fast_export_modify(const char *path, uint32_t mode, const char *dataref);
 void fast_export_begin_commit(uint32_t revision, const char *author,
const struct strbuf *log, const char *uuid,
-   const char *url, unsigned long timestamp);
+   const char *url, unsigned long timestamp, const char 
*local_ref);
 void fast_export_end_commit(uint32_t revision);
 void fast_export_data(uint32_t mode, off_t len, struct line_buffer *input);
 void fast_export_blob_delta(uint32_t mode,
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index d81a078..288bb42 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -299,22 +299,22 @@ static void handle_node(void)
node_ctx.text_length, input);
 }
 
-static void begin_revision(void)
+static void begin_revision(const char *remote_ref)
 {
if (!rev_ctx.revision)  /* revision 0 gets no git commit. */
return;
fast_export_begin_commit(rev_ctx.revision, rev_ctx.author.buf,
rev_ctx.log, dump_ctx.uuid.buf, dump_ctx.url.buf,
-   rev_ctx.timestamp);
+   rev_ctx.timestamp, remote_ref);
 }
 
-static void end_revision(void)
+static void end_revision()
 {
if (rev_ctx.revision)
fast_export_end_commit(rev_ctx.revision);
 }
 
-void svndump_read(const char *url)
+void svndump_read(const char *url, const char *local_ref)
 {
char *val;
char *t;
@@ -353,7 +353,7 @@ void svndump_read(const char *url)
if (active_ctx == NODE_CTX)
handle_node();
if (active_ctx == REV_CTX)
-   begin_revision();
+   begin_revision(local_ref);
if (active_ctx != DUMP_CTX)
end_revision();
active_ctx = REV_CTX;
@@ -366,7 +366,7 @@ void svndump_read(const char *url)
if (active_ctx == NODE_CTX)

[PATCH v6 09/16] Allow reading svn dumps from files via file:// urls

2012-08-22 Thread Florian Achleitner
For testing as well as for importing large, already available dumps,
it's useful to bypass svnrdump and replay the svndump from a file
directly.

Add support for file:// urls in the remote url, e.g.

  svn::file:///path/to/dump

When the remote helper finds an url starting with file:// it tries to
open that file instead of invoking svnrdump.

Signed-off-by: Florian Achleitner florian.achleitner.2.6...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 remote-testsvn.c |   55 +++---
 1 file changed, 36 insertions(+), 19 deletions(-)

diff --git a/remote-testsvn.c b/remote-testsvn.c
index ebe803b..2b9d151 100644
--- a/remote-testsvn.c
+++ b/remote-testsvn.c
@@ -9,6 +9,7 @@
 #include argv-array.h
 
 static const char *url;
+static int dump_from_file;
 static const char *private_ref;
 static const char *remote_ref = refs/heads/master;
 
@@ -53,29 +54,38 @@ static int cmd_import(const char *line)
struct argv_array svndump_argv = ARGV_ARRAY_INIT;
struct child_process svndump_proc;
 
-   memset(svndump_proc, 0, sizeof(struct child_process));
-   svndump_proc.out = -1;
-   argv_array_push(svndump_argv, svnrdump);
-   argv_array_push(svndump_argv, dump);
-   argv_array_push(svndump_argv, url);
-   argv_array_pushf(svndump_argv, -r%u:HEAD, startrev);
-   svndump_proc.argv = svndump_argv.argv;
-
-   code = start_command(svndump_proc);
-   if (code)
-   die(Unable to start %s, code %d, svndump_proc.argv[0], code);
-   dumpin_fd = svndump_proc.out;
-
+   if (dump_from_file) {
+   dumpin_fd = open(url, O_RDONLY);
+   if(dumpin_fd  0) {
+   die_errno(Couldn't open svn dump file %s., url);
+   }
+   }
+   else {
+   memset(svndump_proc, 0, sizeof(struct child_process));
+   svndump_proc.out = -1;
+   argv_array_push(svndump_argv, svnrdump);
+   argv_array_push(svndump_argv, dump);
+   argv_array_push(svndump_argv, url);
+   argv_array_pushf(svndump_argv, -r%u:HEAD, startrev);
+   svndump_proc.argv = svndump_argv.argv;
+
+   code = start_command(svndump_proc);
+   if (code)
+   die(Unable to start %s, code %d, 
svndump_proc.argv[0], code);
+   dumpin_fd = svndump_proc.out;
+   }
svndump_init_fd(dumpin_fd, STDIN_FILENO);
svndump_read(url, private_ref);
svndump_deinit();
svndump_reset();
 
close(dumpin_fd);
-   code = finish_command(svndump_proc);
-   if (code)
-   warning(%s, returned %d, svndump_proc.argv[0], code);
-   argv_array_clear(svndump_argv);
+   if(!dump_from_file) {
+   code = finish_command(svndump_proc);
+   if (code)
+   warning(%s, returned %d, svndump_proc.argv[0], code);
+   argv_array_clear(svndump_argv);
+   }
 
return 0;
 }
@@ -149,8 +159,15 @@ int main(int argc, const char **argv)
remote = remote_get(argv[1]);
url_in = (argc == 3) ? argv[2] : remote-url[0];
 
-   end_url_with_slash(buf, url_in);
-   url = strbuf_detach(buf, NULL);
+   if (!prefixcmp(url_in, file://)) {
+   dump_from_file = 1;
+   url = url_decode(url_in + sizeof(file://)-1);
+   }
+   else {
+   dump_from_file = 0;
+   end_url_with_slash(buf, url_in);
+   url = strbuf_detach(buf, NULL);
+   }
 
strbuf_addf(buf, refs/svn/%s/master, remote-name);
private_ref = strbuf_detach(buf, NULL);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 11/16] Create a note for every imported commit containing svn metadata

2012-08-22 Thread Florian Achleitner
To provide metadata from svn dumps for further processing, e.g.
branch detection, attach a note to each imported commit that stores
additional information.  The notes are currently hard-coded in
refs/notes/svn/revs.  Currently the following lines from the svn dump
are directly accumulated in the note. This can be refined as needed.

 - Revision-number
 - Node-path
 - Node-kind
 - Node-action
 - Node-copyfrom-path
 - Node-copyfrom-rev

Signed-off-by: Florian Achleitner florian.achleitner.2.6...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 vcs-svn/fast_export.c |   14 --
 vcs-svn/fast_export.h |2 ++
 vcs-svn/svndump.c |   21 +++--
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 1ecae4b..df51c59 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -3,8 +3,7 @@
  * See LICENSE for details.
  */
 
-#include git-compat-util.h
-#include strbuf.h
+#include cache.h
 #include quote.h
 #include fast_export.h
 #include repo_tree.h
@@ -68,6 +67,17 @@ void fast_export_modify(const char *path, uint32_t mode, 
const char *dataref)
putchar('\n');
 }
 
+void fast_export_begin_note(uint32_t revision, const char *author,
+   const char *log, unsigned long timestamp)
+{
+   size_t loglen = strlen(log);
+   printf(commit refs/notes/svn/revs\n);
+   printf(committer %s %s@%s %ld +\n, author, author, local, 
timestamp);
+   printf(data %PRIuMAX\n, (uintmax_t)loglen);
+   fwrite(log, loglen, 1, stdout);
+   fputc('\n', stdout);
+}
+
 void fast_export_note(const char *committish, const char *dataref)
 {
printf(N %s %s\n, dataref, committish);
diff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h
index 9b32f1e..c2f6f11 100644
--- a/vcs-svn/fast_export.h
+++ b/vcs-svn/fast_export.h
@@ -10,6 +10,8 @@ void fast_export_deinit(void);
 void fast_export_delete(const char *path);
 void fast_export_modify(const char *path, uint32_t mode, const char *dataref);
 void fast_export_note(const char *committish, const char *dataref);
+void fast_export_begin_note(uint32_t revision, const char *author,
+   const char *log, unsigned long timestamp);
 void fast_export_begin_commit(uint32_t revision, const char *author,
const struct strbuf *log, const char *uuid,
const char *url, unsigned long timestamp, const char 
*local_ref);
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 288bb42..cd65b51 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -48,7 +48,7 @@ static struct {
 static struct {
uint32_t revision;
unsigned long timestamp;
-   struct strbuf log, author;
+   struct strbuf log, author, note;
 } rev_ctx;
 
 static struct {
@@ -77,6 +77,7 @@ static void reset_rev_ctx(uint32_t revision)
rev_ctx.timestamp = 0;
strbuf_reset(rev_ctx.log);
strbuf_reset(rev_ctx.author);
+   strbuf_reset(rev_ctx.note);
 }
 
 static void reset_dump_ctx(const char *url)
@@ -310,8 +311,15 @@ static void begin_revision(const char *remote_ref)
 
 static void end_revision()
 {
-   if (rev_ctx.revision)
+   struct strbuf mark = STRBUF_INIT;
+   if (rev_ctx.revision) {
fast_export_end_commit(rev_ctx.revision);
+   fast_export_begin_note(rev_ctx.revision, remote-svn,
+   Note created by remote-svn., 
rev_ctx.timestamp);
+   strbuf_addf(mark, :%PRIu32, rev_ctx.revision);
+   fast_export_note(mark.buf, inline);
+   fast_export_buf_to_data(rev_ctx.note);
+   }
 }
 
 void svndump_read(const char *url, const char *local_ref)
@@ -358,6 +366,7 @@ void svndump_read(const char *url, const char *local_ref)
end_revision();
active_ctx = REV_CTX;
reset_rev_ctx(atoi(val));
+   strbuf_addf(rev_ctx.note, %s\n, t);
break;
case sizeof(Node-path):
if (constcmp(t, Node-))
@@ -369,10 +378,12 @@ void svndump_read(const char *url, const char *local_ref)
begin_revision(local_ref);
active_ctx = NODE_CTX;
reset_node_ctx(val);
+   strbuf_addf(rev_ctx.note, %s\n, t);
break;
}
if (constcmp(t + strlen(Node-), kind))
continue;
+   strbuf_addf(rev_ctx.note, %s\n, t);
if (!strcmp(val, dir))
node_ctx.type = REPO_MODE_DIR;
else if (!strcmp(val, file))
@@ -383,6 +394,7 @@ void svndump_read(const char *url, const char *local_ref)
case sizeof(Node-action):
  

[PATCH v6 06/16] Add documentation for the 'bidi-import' capability of remote-helpers

2012-08-22 Thread Florian Achleitner
Signed-off-by: Florian Achleitner florian.achleitner.2.6...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 Documentation/git-remote-helpers.txt |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-remote-helpers.txt 
b/Documentation/git-remote-helpers.txt
index f5836e4..5ce4cda 100644
--- a/Documentation/git-remote-helpers.txt
+++ b/Documentation/git-remote-helpers.txt
@@ -98,6 +98,20 @@ advertised with this capability must cover all refs reported 
by
 the list command.  If no 'refspec' capability is advertised,
 there is an implied `refspec *:*`.
 
+'bidi-import'::
+   The fast-import commands 'cat-blob' and 'ls' can be used by 
remote-helpers
+   to retrieve information about blobs and trees that already exist in
+   fast-import's memory. This requires a channel from fast-import to the
+   remote-helper.
+   If it is advertised in addition to import, git establishes a pipe from
+   fast-import to the remote-helper's stdin.
+   It follows that git and fast-import are both connected to the
+   remote-helper's stdin. Because git can send multiple commands to
+   the remote-helper it is required that helpers that use 'bidi-import'
+   buffer all 'import' commands of a batch before sending data to 
fast-import.
+   This is to prevent mixing commands and fast-import responses on the
+   helper's stdin.
+
 Capabilities for Pushing
 
 'connect'::
@@ -286,7 +300,12 @@ terminated with a blank line. For each batch of 'import', 
the remote
 helper should produce a fast-import stream terminated by a 'done'
 command.
 +
-Supported if the helper has the import capability.
+Note that if the 'bidi-import' capability is used the complete batch
+sequence has to be buffered before starting to send data to fast-import
+to prevent mixing of commands and fast-import responses on the helper's
+stdin.
++
+Supported if the helper has the 'import' capability.
 
 'connect' service::
Connects to given service. Standard input and standard output
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 13/16] remote-svn: add incremental import

2012-08-22 Thread Florian Achleitner
Search for a note attached to the ref to update and read it's
'Revision-number:'-line. Start import from the next svn revision.

If there is no next revision in the svn repo, svnrdump terminates with
a message on stderr an non-zero return value. This looks a little
weird, but there is no other way to know whether there is a new
revision in the svn repo.

On the start of an incremental import, the parent of the first commit
in the fast-import stream is set to the branch name to update. All
following commits specify their parent by a mark number. Previous mark
files are currently not reused.

Signed-off-by: Florian Achleitner florian.achleitner.2.6...@gmail.com
Signed-off-by: Junio C Hamano gits...@pobox.com
---
 contrib/svn-fe/svn-fe.c |3 ++-
 remote-testsvn.c|   67 ---
 test-svn-fe.c   |2 +-
 vcs-svn/fast_export.c   |   10 +--
 vcs-svn/fast_export.h   |6 ++---
 vcs-svn/svndump.c   |   10 +++
 vcs-svn/svndump.h   |2 +-
 7 files changed, 84 insertions(+), 16 deletions(-)

diff --git a/contrib/svn-fe/svn-fe.c b/contrib/svn-fe/svn-fe.c
index c796cc0..f363505 100644
--- a/contrib/svn-fe/svn-fe.c
+++ b/contrib/svn-fe/svn-fe.c
@@ -10,7 +10,8 @@ int main(int argc, char **argv)
 {
if (svndump_init(NULL))
return 1;
-   svndump_read((argc  1) ? argv[1] : NULL, refs/heads/master);
+   svndump_read((argc  1) ? argv[1] : NULL, refs/heads/master,
+   refs/notes/svn/revs);
svndump_deinit();
svndump_reset();
return 0;
diff --git a/remote-testsvn.c b/remote-testsvn.c
index b6e7968..e90d221 100644
--- a/remote-testsvn.c
+++ b/remote-testsvn.c
@@ -12,7 +12,8 @@ static const char *url;
 static int dump_from_file;
 static const char *private_ref;
 static const char *remote_ref = refs/heads/master;
-static const char *marksfilename;
+static const char *marksfilename, *notes_ref;
+struct rev_note { unsigned int rev_nr; };
 
 static int cmd_capabilities(const char *line);
 static int cmd_import(const char *line);
@@ -47,14 +48,70 @@ static void terminate_batch(void)
fflush(stdout);
 }
 
+/* NOTE: 'ref' refers to a git reference, while 'rev' refers to a svn 
revision. */
+static char *read_ref_note(const unsigned char sha1[20]) {
+   const unsigned char *note_sha1;
+   char *msg = NULL;
+   unsigned long msglen;
+   enum object_type type;
+   init_notes(NULL, notes_ref, NULL, 0);
+   if( (note_sha1 = get_note(NULL, sha1)) == NULL ||
+   !(msg = read_sha1_file(note_sha1, type, msglen)) ||
+   !msglen || type != OBJ_BLOB) {
+   free(msg);
+   return NULL;
+   }
+   free_notes(NULL);
+   return msg;
+}
+
+static int parse_rev_note(const char *msg, struct rev_note *res) {
+   const char *key, *value, *end;
+   size_t len;
+   while(*msg) {
+   end = strchr(msg, '\n');
+   len = end ? end - msg : strlen(msg);
+
+   key = Revision-number: ;
+   if(!prefixcmp(msg, key)) {
+   long i;
+   value = msg + strlen(key);
+   i = atol(value);
+   if(i  0 || i  UINT32_MAX)
+   return 1;
+   res-rev_nr = i;
+   }
+   msg += len + 1;
+   }
+   return 0;
+}
+
 static int cmd_import(const char *line)
 {
int code;
int dumpin_fd;
-   unsigned int startrev = 0;
+   char *note_msg;
+   unsigned char head_sha1[20];
+   unsigned int startrev;
struct argv_array svndump_argv = ARGV_ARRAY_INIT;
struct child_process svndump_proc;
 
+   if(read_ref(private_ref, head_sha1))
+   startrev = 0;
+   else {
+   note_msg = read_ref_note(head_sha1);
+   if(note_msg == NULL) {
+   warning(No note found for %s., private_ref);
+   startrev = 0;
+   }
+   else {
+   struct rev_note note = { 0 };
+   parse_rev_note(note_msg, note);
+   startrev = note.rev_nr + 1;
+   free(note_msg);
+   }
+   }
+
if (dump_from_file) {
dumpin_fd = open(url, O_RDONLY);
if(dumpin_fd  0) {
@@ -80,7 +137,7 @@ static int cmd_import(const char *line)
feature export-marks=%s\n, marksfilename, 
marksfilename);
 
svndump_init_fd(dumpin_fd, STDIN_FILENO);
-   svndump_read(url, private_ref);
+   svndump_read(url, private_ref, notes_ref);
svndump_deinit();
svndump_reset();
 
@@ -177,6 +234,9 @@ int main(int argc, const char **argv)
strbuf_addf(buf, refs/svn/%s/master, remote-name);
private_ref = strbuf_detach(buf, NULL);
 
+   strbuf_addf(buf, 

git-log combining different detail levels

2012-08-22 Thread Maaartin-1
Quite often I need to see some changes in more detail and others only briefly, 
so I get some idea about the context. For example I'd like something like 
merging the outputs of

git log -p -S Bandersnatch
and
git log --name-status --oneline

together, so I know better what happened.

A simpler (and maybe more important) example is merging

git log -p some/dir
and
git log --name-status

so I could see all the changes, and the chosen ones with all details.

Is this somehow possible?

Regards, Maaartin.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/7] Fix tests under GETTEXT_POISON on git-remote

2012-08-22 Thread Junio C Hamano
Jiang Xin worldhello@gmail.com writes:

 Maybe we should bypass all testcases which calling check_remote_track().

Sounds like it.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact

2012-08-22 Thread Joachim Schmitz
 From: Joachim Schmitz [mailto:j...@schmitz-digital.de]
 Sent: Wednesday, August 22, 2012 7:44 PM
 To: 'Junio C Hamano'
 Cc: 'git@vger.kernel.org'; 'Erik Faye-Lund'; 'Johannes Sixt'; 'Marius
Storm-
 Olsen'
 Subject: RE: [PATCH] Support non-WIN32 system lacking poll() while keeping
 the WIN32 part intact
 
  From: Junio C Hamano [mailto:gits...@pobox.com]
  Sent: Wednesday, August 22, 2012 7:13 PM
  To: Joachim Schmitz
  Cc: git@vger.kernel.org; Erik Faye-Lund; Johannes Sixt; Marius
  Storm-Olsen
  Subject: Re: [PATCH] Support non-WIN32 system lacking poll() while
  keeping the WIN32 part intact
 
  Joachim Schmitz j...@schmitz-digital.de writes:
 
   Signed-off-by: Joachim Schmitz j...@schmitz-digital.de
   ---
Makefile| 18 ++
compat/win32/poll.c |  8 ++--
2 files changed, 20 insertions(+), 6 deletions(-)
  
   diff --git a/Makefile b/Makefile
...
   @@ -1601,6 +1606,11 @@ ifdef NO_GETTEXT ...
   +ifdef NO_POLL
   +   NO_SYS_POLL_H = YesPlease
   +   COMPAT_CFLAGS += -DNO_POLL -Icompat/win32 # so it find poll.h
   +   COMPAT_OBJS += compat/win32/poll.c

This is of course wrong! Needs to be poll.o, not poll.c

   endif
 
  In general, I think this is a good direction to go.  If the existing
  emulation in win32/poll.c turns out to be usable across platforms and
  not windows specific, sharing it would be a good idea.
 
  But if the emulation is no longer windows specific, shouldn't you also
  move it outside compat/win32/ and somewhere more generic?
 
 Should be possible. Esp. as with the current setup make issues a warning:
 
 Makefile:2329: target `compat/win32/poll.c' doesn't match the target
pattern
 
 Haven't yet been able to spot where that comes from.

See above.
 

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] precompompose_utf8.c: iconv_open_or_die

2012-08-22 Thread Torsten Bögershausen
Add the function iconv_open_or_die(), which is used in both
readdir() and precompose_argv()

Optimized away one save/restore of errnor, which is no longer nedded

Signed-off-by: Torsten Bögershausen tbo...@web.de
---
 compat/precompose_utf8.c | 59 ++--
 1 file changed, 27 insertions(+), 32 deletions(-)

diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
index e6c6bf2..d8b189d 100644
--- a/compat/precompose_utf8.c
+++ b/compat/precompose_utf8.c
@@ -13,6 +13,15 @@ typedef char *iconv_ibp;
 static const char *repo_encoding = UTF-8;
 static const char *path_encoding = UTF-8-MAC;
 
+static iconv_t iconv_open_or_die(const char* tocode, const char* fromcode)
+{
+   iconv_t my_iconv;
+   my_iconv = iconv_open(tocode, fromcode);
+   if (my_iconv == (iconv_t) -1)
+   die_errno(_(iconv_open(%s,%s) failed), repo_encoding, 
path_encoding);
+   return my_iconv;
+}
+
 static size_t has_utf8(const char *s, size_t maxlen, size_t *strlen_c)
 {
const uint8_t *utf8p = (const uint8_t *)s;
@@ -78,9 +87,7 @@ void precompose_argv(int argc, const char **argv)
if (argc = i)
return; /* no utf8 found */
 
-   ic_precompose = iconv_open(repo_encoding, path_encoding);
-   if (ic_precompose == (iconv_t) -1)
-   return;
+   ic_precompose = iconv_open_or_die(repo_encoding, path_encoding);
 
for (i = 0; i  argc; i++) {
size_t namelen;
@@ -106,11 +113,8 @@ PREC_DIR *precompose_utf8_opendir(const char *dirname)
free(prec_dir-dirent_nfc);
free(prec_dir);
return NULL;
-   } else {
-   int ret_errno = errno;
+   } else
prec_dir-ic_precompose = (iconv_t)-1;
-   errno = ret_errno;
-   }
 
return prec_dir;
 }
@@ -137,32 +141,23 @@ struct dirent_prec_psx *precompose_utf8_readdir(PREC_DIR 
*prec_dir)
prec_dir-dirent_nfc-d_type = res-d_type;
 
if ((precomposed_unicode == 1)  has_utf8(res-d_name, 
(size_t)-1, NULL)) {
+   iconv_ibp cp = (iconv_ibp)res-d_name;
+   size_t inleft = namelenz;
+   char *outpos = prec_dir-dirent_nfc-d_name[0];
+   size_t outsz = prec_dir-dirent_nfc-max_name_len;
+   size_t cnt;
+   errno = 0;
if (prec_dir-ic_precompose == (iconv_t)-1)
-   prec_dir-ic_precompose =
-   iconv_open(repo_encoding, 
path_encoding);
-   if (prec_dir-ic_precompose == (iconv_t)-1) {
-   die(iconv_open(%s,%s) failed, but needed:\n
-   precomposed unicode is not 
supported.\n
-   If you wnat to use 
decomposed unicode, run\n
-   \git config 
core.precomposeunicode false\\n,
-   repo_encoding, path_encoding);
-   } else {
-   iconv_ibp   cp = (iconv_ibp)res-d_name;
-   size_t inleft = namelenz;
-   char *outpos = prec_dir-dirent_nfc-d_name[0];
-   size_t outsz = 
prec_dir-dirent_nfc-max_name_len;
-   size_t cnt;
-   errno = 0;
-   cnt = iconv(prec_dir-ic_precompose, cp, 
inleft, outpos, outsz);
-   if (errno || inleft) {
-   /*
-* iconv() failed and errno could be 
E2BIG, EILSEQ, EINVAL, EBADF
-* MacOS X avoids illegal byte 
sequemces.
-* If they occur on a mounted drive 
(e.g. NFS) it is not worth to
-* die() for that, but rather let the 
user see the original name
-   */
-   namelenz = 0; /* trigger strlcpy */
-   }
+   prec_dir-ic_precompose =   
iconv_open_or_die(repo_encoding, path_encoding);
+   cnt = iconv(prec_dir-ic_precompose, cp, inleft, 
outpos, outsz);
+   if (errno || inleft) {
+   /*
+* iconv() failed and errno could be E2BIG, 
EILSEQ, EINVAL, EBADF
+* MacOS X avoids illegal byte sequemces.
+* If they occur on a mounted drive (e.g. NFS) 
it is not worth to
+* die() for that, but rather let the user see 
the original name
+   

Re: git-log combining different detail levels

2012-08-22 Thread Jeff King
On Wed, Aug 22, 2012 at 09:25:06PM +0200, Maaartin-1 wrote:

 Quite often I need to see some changes in more detail and others only
 briefly, so I get some idea about the context. For example I'd like
 something like merging the outputs of
 
 git log -p -S Bandersnatch
 and
 git log --name-status --oneline
 
 together, so I know better what happened.
 
 A simpler (and maybe more important) example is merging
 
 git log -p some/dir
 and
 git log --name-status
 
 so I could see all the changes, and the chosen ones with all details.

No, I don't think this is possible. We have --full-diff, which
disconnects the path-limiting from the diff generation, so that:

  git log --full-diff --name-status some/dir

would choose only commits for some/dir, but show the full diff of each
commit.

However, what you are asking is to disconnect the two diff options: one
verbose option only for interesting parts of the diff, and then a
more sparse option for the rest. I'm pretty sure the diff machinery does
not currently understand such an option.

It would not be impossible to implement, I think, but I suspect it would
involve refactoring the format selection in the diff code quite a bit.
In the meantime, one thing you can do is generate the full diff output
and then post-process it to collapse the uninteresting bits.  I haven't
tried, but you can probably do something like this using folds in your
editor (e.g., shrink all of the diff content for a file to a single
line, but then expand it on demand).

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Porting git to HP NonStop

2012-08-22 Thread Joachim Schmitz
Hi folks

There another API missing on HP NonStop and that is setitimer(), used in 
progress.c and build/log.c
I do have a homebrewed implementation, on top of alarm(), it goes like this:

#include ../git-compat-util.h
#undef getitimer
#undef setitimer


int
git_getitimer(int which, struct itimerval *value)
{
int ret = 0;

switch (which) {
case ITIMER_REAL:
value-it_value.tv_usec = 0;
value-it_value.tv_sec = alarm(0);
ret = 0; /* if alarm() fails we get a SIGLIMIT */
break;
case ITIMER_VIRTUAL: /* FALLTHRU */
case ITIMER_PROF: errno = ENOTSUP; ret = -1; break;
default: errno = EINVAL; ret = -1;
}
return ret;
}

int
git_setitimer(int which, const struct itimerval *value,
struct itimerval *ovalue)
{
int ret = 0;

if (!value
|| value-it_value.tv_usec  0
|| value-it_value.tv_usec  100
|| value-it_value.tv_sec  0) {
errno = EINVAL;
return -1;
}

else if (ovalue)
if (!git_getitimer(which, ovalue))
return -1; /* errno set in git_getitimer() */

else
switch (which) {
case ITIMER_REAL:
alarm(value-it_value.tv_sec +
(value-it_value.tv_usec  0) ? 1 : 0);
ret = 0; /* if alarm() fails we get a SIGLIMIT */
break;
case ITIMER_VIRTUAL: /* FALLTHRU */
case ITIMER_PROF: errno = ENOTSUP; ret = -1; break;
default: errno = EINVAL; ret = -1;
}

return ret;
}


Worth being added to compat/, e.g. as setitimer.c, or, as itimer.c (as a 
by-product, it has getitimer() too)?

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 Hi folks

 There another API missing on HP NonStop and that is setitimer(), used in 
 progress.c and build/log.c
 I do have a homebrewed implementation, on top of alarm(), it goes like this:

 #include ../git-compat-util.h
 #undef getitimer
 #undef setitimer


 int
 git_getitimer(int which, struct itimerval *value)

See Documentation/CodingGuidelines for style nits.

 {
 int ret = 0;

 switch (which) {
 case ITIMER_REAL:
 value-it_value.tv_usec = 0;
 value-it_value.tv_sec = alarm(0);
 ret = 0; /* if alarm() fails we get a SIGLIMIT */
 break;
 case ITIMER_VIRTUAL: /* FALLTHRU */
 case ITIMER_PROF: errno = ENOTSUP; ret = -1; break;
 default: errno = EINVAL; ret = -1;
 }
 return ret;
 }

 int
 git_setitimer(int which, const struct itimerval *value,
 struct itimerval *ovalue)
 {
 int ret = 0;

 if (!value
 || value-it_value.tv_usec  0
 || value-it_value.tv_usec  100
 || value-it_value.tv_sec  0) {
 errno = EINVAL;
 return -1;
 }

 else if (ovalue)
 if (!git_getitimer(which, ovalue))
 return -1; /* errno set in git_getitimer() */

 else
 switch (which) {
 case ITIMER_REAL:
 alarm(value-it_value.tv_sec +
 (value-it_value.tv_usec  0) ? 1 : 0);
 ret = 0; /* if alarm() fails we get a SIGLIMIT */
 break;
 case ITIMER_VIRTUAL: /* FALLTHRU */
 case ITIMER_PROF: errno = ENOTSUP; ret = -1; break;
 default: errno = EINVAL; ret = -1;
 }

 return ret;
 }


 Worth being added to compat/, e.g. as setitimer.c, or, as itimer.c
 (as a by-product, it has getitimer() too)?

If it helps your port, compat/itimer.c sounds like a good place.
Doesn't it need a new header file to introduce structures and
constants, too?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

  diff --git a/http.c b/http.c
  index b61ac85..18bc6bf 100644
  --- a/http.c
  +++ b/http.c
  @@ -806,10 +806,12 @@ static int http_request(const char *url, void
  *result, int target, int options)
 
 Likewrapped X-

 Any suggestion?

Other than don't wrap (or get a real MUA and MTA X-),
unfortunately no.

I do not know if you have checked MUA specific hints section of
Documentation/SubmittingPatches; there may be environment specific
hints described for a MUA you may have at hand (or not).

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Porting git to HP NonStop

2012-08-22 Thread Joachim Schmitz
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 10:50 PM
 To: Joachim Schmitz
 Cc: git@vger.kernel.org; rsbec...@nexbridge.com
 Subject: Re: Porting git to HP NonStop
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  Hi folks
 
  There another API missing on HP NonStop and that is setitimer(), used
  in progress.c and build/log.c I do have a homebrewed implementation, on
top
 of alarm(), it goes like this:
 
  #include ../git-compat-util.h
  #undef getitimer
  #undef setitimer
 
 
  int
  git_getitimer(int which, struct itimerval *value)
 
 See Documentation/CodingGuidelines for style nits.

Will do and adjust code accordingly. Here I was more concerned about content
though ;-)

...
  Worth being added to compat/, e.g. as setitimer.c, or, as itimer.c (as
  a by-product, it has getitimer() too)?
 
 If it helps your port, compat/itimer.c sounds like a good place.
 Doesn't it need a new header file to introduce structures and constants,
too?

You mean the ITIMER_* and struct itimerval, right?
On NonStop these are available in sys/time.h, so here's no need to add
them.

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0

2012-08-22 Thread Joachim Schmitz
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 11:02 PM
 To: Joachim Schmitz
 Cc: git@vger.kernel.org
 Subject: Re: [PATCH] Don't use curl_easy_strerror prior to curl-7.12.0
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
   diff --git a/http.c b/http.c
   index b61ac85..18bc6bf 100644
   --- a/http.c
   +++ b/http.c
   @@ -806,10 +806,12 @@ static int http_request(const char *url, void
   *result, int target, int options)
 
  Likewrapped X-
 
  Any suggestion?
 
 Other than don't wrap (or get a real MUA and MTA X-), unfortunately
no.
 
 I do not know if you have checked MUA specific hints section of
 Documentation/SubmittingPatches; there may be environment specific hints
 described for a MUA you may have at hand (or not).

I checked, but Outlook isn't mentioned :-(

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 If it helps your port, compat/itimer.c sounds like a good place.
 Doesn't it need a new header file to introduce structures and constants,
 too?

 You mean the ITIMER_* and struct itimerval, right?
 On NonStop these are available in sys/time.h, so here's no need to add
 them.

At least you would need a header to declare these two functions and
make them visible so that the remainder of the codebase will not
have to know about git_setitimer(), no?  Or does your header files
on NonStop declare setitimer() but does not implement it?

As your proposed name is not compat/tandem.c but more generic
sounding compat/itimer.c, we would have to plan for systems other
than NonStop, so we may later have to introduce makefile variables
to ask that header file to declare the structure and define the
constants that are missing from such a system.  While you are
porting to NonStop, you may not have to define/declare them, but
knowing that these files are the place to later do so is part of the
planning.


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] git-p4: Strip branch name prefixes if --use-client-spec enabled

2012-08-22 Thread Pete Wyckoff
casey.mcgi...@gmail.com wrote on Mon, 20 Aug 2012 13:43 -1000:
 This removes the branch names from being included in the file system
 path when using the both --use-client-spec and --detect-branches
 options.
 
 Used alone, the --detect-branches option did the right thing, removing
 the branch names from the relative git path. By adding the
 --use-client-spec option, the old logic would incorrectly bypass this
 step.

Thanks for reporting this bug, and supplying a fix.  I think,
though that this is the same issue we were looking at in this
thread:

http://article.gmane.org/gmane.comp.version-control.git/203294

It is queued up and the fix likely will appear in 1.7.13 (or
whatever the next release after 1.7.12 is called).

(Gmane has been down all day from here; there's information from
another reporter in http://stackoverflow.com/questions/11893688/ .)

-- Pete
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Porting git to HP NonStop

2012-08-22 Thread Joachim Schmitz


 -Original Message-
 From: Junio C Hamano [mailto:gits...@pobox.com]
 Sent: Wednesday, August 22, 2012 11:12 PM
 To: Joachim Schmitz
 Cc: git@vger.kernel.org; rsbec...@nexbridge.com
 Subject: Re: Porting git to HP NonStop
 
 Joachim Schmitz j...@schmitz-digital.de writes:
 
  If it helps your port, compat/itimer.c sounds like a good place.
  Doesn't it need a new header file to introduce structures and
  constants,
  too?
 
  You mean the ITIMER_* and struct itimerval, right?
  On NonStop these are available in sys/time.h, so here's no need to
  add them.
 
 At least you would need a header to declare these two functions and make
 them visible so that the remainder of the codebase will not have to know
about
 git_setitimer(), no?  Or does your header files on NonStop declare
setitimer()
 but does not implement it?

No it doesn't, at least not if a form visible to a compiler...

 As your proposed name is not compat/tandem.c but more generic sounding
 compat/itimer.c, we would have to plan for systems other than NonStop, so
we
 may later have to introduce makefile variables to ask that header file to
 declare the structure and define the constants that are missing from such
a
 system.  While you are porting to NonStop, you may not have to
define/declare
 them, but knowing that these files are the place to later do so is part of
the
 planning.

I thought of having the function decclaration in git-compat-util.h, just
like for eg. setenv, gitmkdtemp, etc.

Bye, Jojo

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Git to use XDG Base Directory Standard

2012-08-22 Thread Lanoxx

Hi,

Git and Gitk are currently using the ~/.gitconfig and ~/.gitk files in 
the $HOME directory. It would be nice to use the XDG Base Directory 
standard for the location instead, see [1] and [2]. Are there any plans 
regarding this standard?


Best Regards
Lanoxx

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
[2] https://live.gnome.org/GnomeGoals/XDGConfigFolders
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Git to use XDG Base Directory Standard

2012-08-22 Thread Carlos Martín Nieto
Lanoxx lan...@gmx.net writes:

 Hi,

 Git and Gitk are currently using the ~/.gitconfig and ~/.gitk files in
 the $HOME directory. It would be nice to use the XDG Base Directory
 standard for the location instead, see [1] and [2]. Are there any
 plans regarding this standard?

Git does this starting at 1.7.12. See the release notes, e.g. at
https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.12.txt#L18-23

   cmn
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Porting git to HP NonStop

2012-08-22 Thread Junio C Hamano
Joachim Schmitz j...@schmitz-digital.de writes:

 I thought of having the function decclaration in git-compat-util.h, just
 like for eg. setenv, gitmkdtemp, etc.

Yeah, that's also fine, especially if you do not have to declare
structures and constants.

Once you start having to declare other things in order to declare
the function missing on the system, it won't be like setenv where a
pair of #ifdef NO_SETENV/#endif just surrounds a single line.  At
that point, a separate header file to hold them together would
become easier to read.  It's a judgement call; we'll see how it
turns out (we do not have to get everything right in our first
attempt).

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] specifying ranges: we did not mean to make .. an empty set

2012-08-22 Thread Junio C Hamano
Date: Mon, 2 May 2011 13:39:16 -0700

Either end of revision range operator can be omitted to default to HEAD,
as in origin.. (what did I do since I forked) or ..origin (what did
they do since I forked).  But the current parser interprets ..  as an
empty range HEAD..HEAD, and worse yet, because .. does exist on the
filesystem, we get this annoying output:

  $ cd Documentation/howto
  $ git log .. ;# give me recent commits that touch Documentation/ area.
  fatal: ambiguous argument '..': both revision and filename
  Use '--' to separate filenames from revisions

Surely we could say git log ../ or even git log -- .. to disambiguate,
but we shouldn't have to.

Helped-by: Jeff King p...@peff.net
Signed-off-by: Junio C Hamano gits...@pobox.com
---

 * The other day I was looking into my old pile of leftover bits,
   and found this ($gmane/172619).  This is rebased to more recent
   codebase, but it is still relevant.

   Comments, other than we may want to reuse 'log ..' as a
   short-hand for 'log @{u}..', which is an utter nonsense?

 Documentation/revisions.txt|  7 +++
 builtin/rev-parse.c| 16 ++--
 revision.c | 16 ++--
 t/t1506-rev-parse-diagnosis.sh | 14 ++
 t/t4202-log.sh |  7 +++
 5 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
index dc0070b..69d996b 100644
--- a/Documentation/revisions.txt
+++ b/Documentation/revisions.txt
@@ -213,6 +213,13 @@ of 'r1' and 'r2' and is defined as
 It is the set of commits that are reachable from either one of
 'r1' or 'r2' but not from both.
 
+In these two shorthands, you can omit one end and let it default to HEAD.
+For example, 'origin..' is a shorthand for 'origin..HEAD' and asks What
+did I do since I forked from the origin branch?  Similarly, '..origin'
+is a shorthand for 'HEAD..origin' and asks What did the origin do since
+I forked from them?  Note that '..' would mean 'HEAD..HEAD' which is an
+empty range that is both reachable and unreachable from HEAD.
+
 Two other shorthands for naming a set that is formed by a commit
 and its parent commits exist.  The 'r1{caret}@' notation means all
 parents of 'r1'.  'r1{caret}!' includes commit 'r1' but excludes
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 13495b8..47b4e7a 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -224,6 +224,7 @@ static int try_difference(const char *arg)
const char *next;
const char *this;
int symmetric;
+   static const char head_by_default[] = HEAD;
 
if (!(dotdot = strstr(arg, ..)))
return 0;
@@ -235,9 +236,20 @@ static int try_difference(const char *arg)
next += symmetric;
 
if (!*next)
-   next = HEAD;
+   next = head_by_default;
if (dotdot == arg)
-   this = HEAD;
+   this = head_by_default;
+
+   if (this == head_by_default  next == head_by_default 
+   !symmetric) {
+   /*
+* Just ..?  That is not a range but the
+* pathspec for the parent directory.
+*/
+   *dotdot = '.';
+   return 0;
+   }
+
if (!get_sha1(this, sha1)  !get_sha1(next, end)) {
show_rev(NORMAL, end, next);
show_rev(symmetric ? NORMAL : REVERSED, sha1, this);
diff --git a/revision.c b/revision.c
index 5b81a92..457868d 100644
--- a/revision.c
+++ b/revision.c
@@ -1132,15 +1132,27 @@ int handle_revision_arg(const char *arg_, struct 
rev_info *revs,
const char *this = arg;
int symmetric = *next == '.';
unsigned int flags_exclude = flags ^ UNINTERESTING;
+   static const char head_by_default[] = HEAD;
unsigned int a_flags;
 
*dotdot = 0;
next += symmetric;
 
if (!*next)
-   next = HEAD;
+   next = head_by_default;
if (dotdot == arg)
-   this = HEAD;
+   this = head_by_default;
+   if (this == head_by_default  next == head_by_default 
+   !symmetric) {
+   /*
+* Just ..?  That is not a range but the
+* pathspec for the parent directory.
+*/
+   if (!cant_be_filename) {
+   *dotdot = '.';
+   return -1;
+   }
+   }
if (!get_sha1(this, from_sha1) 
!get_sha1(next, sha1)) {
struct commit *a, *b;
diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
index c5cb77a..0cd2a2a 100755
--- a/t/t1506-rev-parse-diagnosis.sh
+++ b/t/t1506-rev-parse-diagnosis.sh
@@ 

[PATCH] Make 'git submodule update --force' always check out submodules.

2012-08-22 Thread Stefan Zager
Currently, it will only do a checkout if the sha1 registered in the containing
repository doesn't match the HEAD of the submodule, regardless of whether the
submodule is dirty.  As discussed on the mailing list, the '--force' flag is a
strong indicator that the state of the submodule is suspect, and should be reset
to HEAD.

Signed-off-by: Stefan Zager sza...@google.com
---
 Documentation/git-submodule.txt |  9 -
 git-submodule.sh|  2 +-
 t/t7406-submodule-update.sh | 12 
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index fbbbcb2..2de7bf0 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -149,6 +149,11 @@ submodule with the `--init` option.
 +
 If `--recursive` is specified, this command will recurse into the
 registered submodules, and update any nested submodules within.
++
+If `--force` is specified, the submodule will be checked out (using
+`git checkout --force` if appropriate), even if the commit specified in the
+index of the containing repository already matches the commit checked out in
+the submodule.
 
 summary::
Show commit summary between the given commit (defaults to HEAD) and
@@ -210,7 +215,9 @@ OPTIONS
This option is only valid for add and update commands.
When running add, allow adding an otherwise ignored submodule path.
When running update, throw away local changes in submodules when
-   switching to a different commit.
+   switching to a different commit; and always run a checkout operation
+   in the submodule, even if the commit listed in the index of the
+   containing repository matches the commit checked out in the submodule.
 
 --cached::
This option is only valid for status and summary commands.  These
diff --git a/git-submodule.sh b/git-submodule.sh
index aac575e..3aa7644 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -578,7 +578,7 @@ Maybe you want to use 'update --init'?)
die $(eval_gettext Unable to find current revision in 
submodule path '\$sm_path')
fi
 
-   if test $subsha1 != $sha1
+   if test $subsha1 != $sha1 -o -n $force
then
subforce=$force
# If we don't already have a -f flag and the submodule 
has never been checked out
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index ce61d4c..9706436 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -123,6 +123,18 @@ test_expect_success 'submodule update should throw away 
changes with --force ' '
)
 '
 
+test_expect_success 'submodule update --force forcibly checks out submodules' '
+   (cd super 
+(cd submodule 
+ rm -f file
+) 
+git submodule update --force submodule 
+(cd submodule 
+ test $(git status -s file) = 
+)
+   )
+'
+
 test_expect_success 'submodule update --rebase staying on master' '
(cd super/submodule 
  git checkout master
-- 
1.7.12.2.gf3df7bf.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: How to request a fast-forward pull

2012-08-22 Thread Ben Hutchings
On Tue, 2012-08-21 at 10:22 -0700, Junio C Hamano wrote:
 Jeff King p...@peff.net writes:
 
  On Mon, Aug 20, 2012 at 01:40:33PM -0700, Jonathan Nieder wrote:
 
   When you have a moment, would you please migrate this
   across to your main linux-stable repository?
  
   Both a branch and signed tag are present and pointing at
   the same commit, but git request-pull does favour output
   of the tag over the branch name.
  
   But merging the tag will want to create a merge commit.
  
   So, to avoid a merge commit in your repo, you can fetch
   (fast fwd) into your (local) branch from my branch at:
  
git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux-stable.git 
   linux-2.6.34.y
  
   and then fetch the signed tag listed below after that.
  
  Can this be made easier?  I could imagine request-pull learning
  --ff-only that generates a message like
  
 Greg,
  
 Please pull --ff-only
 
 Where did the Greg,\n\n come from?  Isn't it just the matter of
 adding the --ff-only when that string is added?
 
  
  git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux-stable.git 
  linux-2.6.34.y
  
 to get the following changes [...]
  
  which could work ok if the recipient notices the --ff-only, but I
  wonder if there is a simpler way.
 
  If it is something important for the sender to communicate to the
  recipient as part of the pull command-line, then I would think the
  natural place is on the line with the rest of it, like:
 
Please pull:
 
  --ff-only remote ref
 
  It's maximally noticeable to the recipient, then, and anybody
  cutting-and-pasting the whole line would get it automagically. That is
  as close to machine-readable as pull-request emails get.
 
  However, I have to wonder if that is a good idea in general. Isn't the
  decision to --ff-only or not really the puller's business? In the
  general case, I would not expect senders of pull request to have advice
  in this area.
 
 Yes, absolutely.  The advice of the sender that would be more
 helpful is not how, but where/when.  Is the topic meant for
 the maintenance track?  Why is it appropriate to pull this series at
 this moment in the history of the overall project?
 
  This particular case seems to be caused by a policy mismatch between the
  project and request-pull. The latter's behavior to favor a matching tag
  is because tags carry more information. But in this case, it sounds like
  the project would rather avoid the extra merge commits, even if it means
  losing information.
 
 That's a project decision and can be done by whoever is pulling, as
 you mentioned earlier.
 
 In any case, why is this even become an issue in the context of
 linux-stable?  I thought people over there were working hard to
 *increase* verifiability of the history by using signed merges,
[...]

Each *stable update* series is a single branch made up almost entirely
of cherry-picked commits, possibly managed as a quilt series before
being reviewed and then committed.  Tags are signed, and each commit has
a reference to the original (though the format of that reference isn't
well standardised).

Although Greg owns the linux-stable.git repository, several stable
updates series and the corresponding branches are maintained by others,
such as Paul and myself.  When Greg pulls from them, he's mirroring the
other maintainer's branch and never merging with anyone else's work.  So
it should always be a fast-forward merge.  Further, the head of the
branch is always going to have a tag signed by the respective
maintainer.

Ben.

-- 
Ben Hutchings
Experience is what causes a person to make new mistakes instead of old ones.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] Make 'git submodule update --force' always check out submodules.

2012-08-22 Thread Junio C Hamano
Stefan Zager sza...@google.com writes:

 Currently, it will only do a checkout if the sha1 registered in the containing
 repository doesn't match the HEAD of the submodule, regardless of whether the
 submodule is dirty.  As discussed on the mailing list, the '--force' flag is a
 strong indicator that the state of the submodule is suspect, and should be 
 reset
 to HEAD.

 Signed-off-by: Stefan Zager sza...@google.com
 ---

Thanks for a reroll.  Will queue; looking good ;-)

  Documentation/git-submodule.txt |  9 -
  git-submodule.sh|  2 +-
  t/t7406-submodule-update.sh | 12 
  3 files changed, 21 insertions(+), 2 deletions(-)

 diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
 index fbbbcb2..2de7bf0 100644
 --- a/Documentation/git-submodule.txt
 +++ b/Documentation/git-submodule.txt
 @@ -149,6 +149,11 @@ submodule with the `--init` option.
  +
  If `--recursive` is specified, this command will recurse into the
  registered submodules, and update any nested submodules within.
 ++
 +If `--force` is specified, the submodule will be checked out (using
 +`git checkout --force` if appropriate), even if the commit specified in the
 +index of the containing repository already matches the commit checked out in
 +the submodule.
  
  summary::
   Show commit summary between the given commit (defaults to HEAD) and
 @@ -210,7 +215,9 @@ OPTIONS
   This option is only valid for add and update commands.
   When running add, allow adding an otherwise ignored submodule path.
   When running update, throw away local changes in submodules when
 - switching to a different commit.
 + switching to a different commit; and always run a checkout operation
 + in the submodule, even if the commit listed in the index of the
 + containing repository matches the commit checked out in the submodule.
  
  --cached::
   This option is only valid for status and summary commands.  These
 diff --git a/git-submodule.sh b/git-submodule.sh
 index aac575e..3aa7644 100755
 --- a/git-submodule.sh
 +++ b/git-submodule.sh
 @@ -578,7 +578,7 @@ Maybe you want to use 'update --init'?)
   die $(eval_gettext Unable to find current revision in 
 submodule path '\$sm_path')
   fi
  
 - if test $subsha1 != $sha1
 + if test $subsha1 != $sha1 -o -n $force
   then
   subforce=$force
   # If we don't already have a -f flag and the submodule 
 has never been checked out
 diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
 index ce61d4c..9706436 100755
 --- a/t/t7406-submodule-update.sh
 +++ b/t/t7406-submodule-update.sh
 @@ -123,6 +123,18 @@ test_expect_success 'submodule update should throw away 
 changes with --force ' '
   )
  '
  
 +test_expect_success 'submodule update --force forcibly checks out 
 submodules' '
 + (cd super 
 +  (cd submodule 
 +   rm -f file
 +  ) 
 +  git submodule update --force submodule 
 +  (cd submodule 
 +   test $(git status -s file) = 
 +  )
 + )
 +'
 +
  test_expect_success 'submodule update --rebase staying on master' '
   (cd super/submodule 
 git checkout master
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Git to use XDG Base Directory Standard

2012-08-22 Thread David Aguilar
On Wed, Aug 22, 2012 at 2:44 PM, Carlos Martín Nieto c...@elego.de wrote:
 Lanoxx lan...@gmx.net writes:

 Hi,

 Git and Gitk are currently using the ~/.gitconfig and ~/.gitk files in
 the $HOME directory. It would be nice to use the XDG Base Directory
 standard for the location instead, see [1] and [2]. Are there any
 plans regarding this standard?

 Git does this starting at 1.7.12. See the release notes, e.g. at
 https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.12.txt#L18-23

cmn

I do not recall whether gitk learned about it (I don't think so).

Like all big sweeping changes, these were done in a
backwards-compatible way that will allow users to switch over when
they are ready.  If you are interested in attacking this from the gitk
angle then you will want to follow a similar strategy.
-- 
David
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Feature request - discard hunk in add --patch mode

2012-08-22 Thread Mina Almasry
Well I actually didn't know about stash -p when I asked for this, but I
still see room for us removing some more friction here:

 # start from N-commit worth of change, debug and WIP
 git stash save -p debug ;# stash away only the debugging aid
 # now we have only N-commit worth of change and WIP
 git stash save -p wip ;# stash away WIP
 
 Then after that, you need N round of git add -p  git commit.
 
 Now, with what we have already, can we also give final testing
 before committing?  Each round may now start with:
 
 git add -p ;# prepare the index for the next commit
 git stash save -k ;# save away the changes for later commits
 
Here you have to _at least_ go through all your hunks once to stash the
debug code, once to stash the WIP, and once to add -p and commit.

Going through hunks is expensive... it takes quite a bit of time. Each
time you launch one of those commands you have to go through all hunks
you haven't decided on yet - could be a lot of hunks.

Now, what if we had a command where you would go through all your hunks
one, by one, and will give you an option to stage, stash, or discard
what you want as you please? In the above scenario, lets say N was 1,
then the scenario would be:

# start from 1-commit worth of change, debug and WIP

# stash debugging and WIP code, 
# and stage the code you want to commit
git mystery-command

# everything done
git commit

Then we would reduce 3 -p commands to 1 -p command.

Now what should this command be called? You resist making git-add unsafe
and I understand that. How about: 

  1. Give git add -p options that expose this extra functionality. So:

git add -p ; # can only stage code
git add -p --with-discard ; # does git add -p, plus discards hunks
git add -p --with-discard --with-stage ; # plus discard, plus stage

So in the hunks you can go:
  - discard; # and it would discard it
  - stage stash; # and it would stash it into stash

The argument I am making is that if a programmer explicitly asks for one
of those features then git will cooperate, and add becomes unsafe. We
are trusting that the programmer knows what they are doing. In all other
cases git add is the same, and will never touch the working tree.

We can also change git checkout -p and git stash -p so that they behave
the same:

  git stash -p --with-add; # does everything -p stash, and stages too
  git checkout -p --with-add; # does everything -p checkout, and stages

  2. We can come up with a whole new git command that does this.
Something like git patch-process

  # start from 1-commit worth of change, debug and WIP

  git patch-process ; # Stage, stash, and discard hunks as you please

  # ready for commit
  git commit

How does this sound?

PS: Newbish question: I am looking to help out with git, either with
this feature or others. How do I get around getting assigned a work to
do? Thanks.

Mina

On Wed, 2012-08-15 at 16:58 -0400, Mina Almasry wrote:
 On 12-08-15 02:46 PM, Junio C Hamano wrote:
  Junio C Hamano gits...@pobox.com writes:
 
  Thomas Rast tr...@student.ethz.ch writes:
 
  This has come up before, and actually led to the introduction of
  'checkout -p' and 'reset -p':
 
 http://thread.gmane.org/gmane.comp.version-control.git/123854
  That is a blast from the past.
 
  Why is saying git checkout . too much work, after add -p that
  you excluded the debugging cruft?
  Please forget this question.  A better way in the form of stash -p
  was suggested in the old thread to get rid of debug cruft in the
  tree before an add -p session (or during a series of add -p
  sessions).
 
  So is this still an issue?
 
 
 I read most of the thread, and I do think it still is. Here are my 2 cents:
 
 1. The alternative commands aren't nearly as time efficient:
  - git checkout . is fast and awesome, but you can't use it if, for 
 example, you have to maintain a dirty working tree
  - git (stash|reset|checkout) -p make you go through (all|most) of 
 the hunks you have to hunt down those 2 lines that say echo 
 'This line is runningantoeuhaoeuaoae'
 
 2. All of the safety concerns can be alleviated with the right 
 interface. I am glad the u option mentioned in the thread did not go 
 through since I agree it is not ideal. However, if the command is:
  (a) something with a '!', then no one will hit it by mistake, and
  (b) the prompt makes it clear that work is lost
 then I think it would be fine
 
 The advantages of a command like this are pretty huge IMO. I can see 
 this being a big time saver.
 
 How about adding this to the git add -p prompt:
 
  r! - remove this hunk. The hunk is discarded from the working tree, 
 and is irrevocably lost.
 --
 To unsubscribe from this list: send the line unsubscribe git in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 


--
To unsubscribe from this list: send the line 

[PATCH] Improved documentation for the ciabot scripts.

2012-08-22 Thread Eric S. Raymond
Signed-off-by: Eric S. Raymond e...@thyrsus.com
---
 contrib/ciabot/INSTALL |   39 +++
 contrib/ciabot/README  |   14 --
 2 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 contrib/ciabot/INSTALL

diff --git a/contrib/ciabot/INSTALL b/contrib/ciabot/INSTALL
new file mode 100644
index 000..dbfd165
--- /dev/null
+++ b/contrib/ciabot/INSTALL
@@ -0,0 +1,39 @@
+= Installation instructions =
+
+Two scripts are included.  The Python one (ciabot.py) is faster and
+more capable; the shell one (ciabot.sh) is a fallback in case Python
+gives your git hosting site indigestion. (I know of no such sites.)
+
+It is no longer necessary to modify the script in order to put it
+in place; in fact, this is now discouraged. It is entirely
+configurable with the following git config variables:
+
+ciabot.project = name of the project (required)
+ciabot.repo = name of the project repo for gitweb/cgit purposes
+ciabot.xmlrpc  = if true (default), ship notifications via XML-RPC
+ciabot.revformat = format in which the revision is shown
+
+The ciabot.repo value defaults to ciabot.project lowercased.
+
+The revformat variable may have the following values
+raw - full hex ID of commit
+short - first 12 chars of hex ID
+describe - describe relative to last tag, falling back to short
+The default is 'describe'.
+
+Once you've set these variables, try your script with -n to see the
+notification message dumped to stdout and verify that it looks sane.
+
+After verifying correct function, install one of these scripts either
+in a post-commit hook or in an update hook.
+
+In post-commit, run it without arguments. It will query for
+current HEAD and the latest commit ID to get the information it
+needs.
+
+In update, call it with a refname followed by a list of commits:
+You want to reverse the order git rev-list emits because it lists
+from most recent to oldest.
+
+/path/to/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac)
+
diff --git a/contrib/ciabot/README b/contrib/ciabot/README
index 3b916ac..9eccca3 100644
--- a/contrib/ciabot/README
+++ b/contrib/ciabot/README
@@ -8,5 +8,15 @@ You probably want the Python version; it's faster, more 
capable, and
 better documented.  The shell version is maintained only as a fallback
 for use on hosting sites that don't permit Python hook scripts.
 
-You will find installation instructions for each script in its comment
-header.
+To test these scripts, your project needs to have been registered with
+the CIA site.  Here are the steps:
+
+1. Open an IRC window on irc://freenode/commits or your registered 
+   project IRC channel.  
+
+2. Run ciabot.py and/or ciabot.sh from any directory under git
+   control, using the -p option to pass in your project name.
+
+You should see a notification on the channel for your most recent commit.
+
+See the file INSTALL for installation instructions.
-- 
1.7.9.5

-- 
a href=http://www.catb.org/~esr/;Eric S. Raymond/a
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re*: mergetool: support --tool-help option like difftool does

2012-08-22 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes:

 This way we do not have to risk the list of tools go out of sync
 between the implementation and the documentation.

 Signed-off-by: Junio C Hamano gits...@pobox.com
 ---
 Junio C Hamano gits...@pobox.com writes:

 +--tool-help::
 +   List the supported and available diff tools.

 This part is a good addition (but it already is mentioned in the
 description of --tool above, so it is more or less a Meh).

 I noticed that the main while loop has style violations in its
 case/esac, but I left it as-is.  Reindenting it would be a low
 hanging fruit janitor patch that would be a separate topic.

After hinting a low-hanging-fruit that would be an easy way for new
people to dip their toes, I saw no takers for one month, so I ended
up doing it myself.

-- 8 --
Subject: mergetool: style fixes

This script is one of the sizeable ones that tempted people to copy
its neibouring style in their new code, but was littered with
styles incompatible with our style guide.

 - use one tab, not four spaces, per indent level;

 - long lines can be wrapped after '|', '', or '||' for
   readability.

 - structures like if .. then .. else .. fi, while .. do .. done
   are split into lines in such a way that does not require
   unnecessary semicolon.

 - case, esac and case-arms align at the same column.

Signed-off-by: Junio C Hamano gits...@pobox.com
---

 * The change would be easier to see if the reader runs these
   command before and after applying this patch:

$ git diff -w git-mergetool.sh
$ git grep -e '^[\t]* ' -e '; *then' -e '; do' git-mergetool.sh

 git-mergetool.sh | 581 +--
 1 file changed, 308 insertions(+), 273 deletions(-)

diff --git i/git-mergetool.sh w/git-mergetool.sh
index 0db0c44..c50e18a 100755
--- i/git-mergetool.sh
+++ w/git-mergetool.sh
@@ -18,270 +18,301 @@ require_work_tree
 
 # Returns true if the mode reflects a symlink
 is_symlink () {
-test $1 = 12
+   test $1 = 12
 }
 
 is_submodule () {
-test $1 = 16
+   test $1 = 16
 }
 
 local_present () {
-test -n $local_mode
+   test -n $local_mode
 }
 
 remote_present () {
-test -n $remote_mode
+   test -n $remote_mode
 }
 
 base_present () {
-test -n $base_mode
+   test -n $base_mode
 }
 
 cleanup_temp_files () {
-if test $1 = --save-backup ; then
-   rm -rf -- $MERGED.orig
-   test -e $BACKUP  mv -- $BACKUP $MERGED.orig
-   rm -f -- $LOCAL $REMOTE $BASE
-else
-   rm -f -- $LOCAL $REMOTE $BASE $BACKUP
-fi
+   if test $1 = --save-backup
+   then
+   rm -rf -- $MERGED.orig
+   test -e $BACKUP  mv -- $BACKUP $MERGED.orig
+   rm -f -- $LOCAL $REMOTE $BASE
+   else
+   rm -f -- $LOCAL $REMOTE $BASE $BACKUP
+   fi
 }
 
 describe_file () {
-mode=$1
-branch=$2
-file=$3
-
-printf   {%s}:  $branch
-if test -z $mode; then
-   echo deleted
-elif is_symlink $mode ; then
-   echo a symbolic link - '$(cat $file)'
-elif is_submodule $mode ; then
-   echo submodule commit $file
-else
-   if base_present; then
-   echo modified file
+   mode=$1
+   branch=$2
+   file=$3
+
+   printf   {%s}:  $branch
+   if test -z $mode
+   then
+   echo deleted
+   elif is_symlink $mode
+   then
+   echo a symbolic link - '$(cat $file)'
+   elif is_submodule $mode
+   then
+   echo submodule commit $file
+   elif base_present
+   then
+   echo modified file
else
-   echo created file
+   echo created file
fi
-fi
 }
 
-
 resolve_symlink_merge () {
-while true; do
-   printf Use (l)ocal or (r)emote, or (a)bort? 
-   read ans || return 1
-   case $ans in
-   [lL]*)
-   git checkout-index -f --stage=2 -- $MERGED
-   git add -- $MERGED
-   cleanup_temp_files --save-backup
-   return 0
-   ;;
-   [rR]*)
-   git checkout-index -f --stage=3 -- $MERGED
-   git add -- $MERGED
-   cleanup_temp_files --save-backup
-   return 0
-   ;;
-   [aA]*)
-   return 1
-   ;;
-   esac
+   while true
+   do
+   printf Use (l)ocal or (r)emote, or (a)bort? 
+   read ans || return 1
+   case $ans in
+   [lL]*)
+   git checkout-index -f --stage=2 -- $MERGED
+   git add -- $MERGED
+   cleanup_temp_files --save-backup
+   return 0
+   ;;
+   [rR]*)
+   git checkout-index -f --stage=3 -- $MERGED
+   git add -- $MERGED
+   cleanup_temp_files --save-backup
+