* Re: Git bug. gitattributes' pattern does not respect spaces in the filenames
From: Alexey Shumkin @ 2011-10-10 15:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vipnwooh1.fsf@alter.siamese.dyndns.org>
> Alexey Shumkin <Alex.Crezoff@gmail.com> writes:
>
> > As far as cp1251 and UTF-8 files are in different folders,
> > it is logically enough to set pattern like
> >
> > <folder with a UTF-8-xmls>/*.xml diff=utf8-to-cp1251
> >
> > for the UTF-8 files.
>
> ... IN the directory that needs conversion and not in the other one
> or at the toplevel. Problem solved, no?
Oh! yes! solved! thanks!
I did not take into account that each folder can have
its own .gitattributes-file
>
> Another idea may be to use "?" in the directory part of the
> pattern. Unless the directory structure is sick enough to have these
> directory names:
>
> dir-1/utf8-file.xml
> dir 1/cp1251-file.xml
>
> dir?1/*.xml would match the matter, so...
hmm... I like more the case above :)
but TMTOWTDI principle rulez
thanks again
^ permalink raw reply
* Re: Git bug. gitattributes' pattern does not respect spaces in the filenames
From: Junio C Hamano @ 2011-10-10 15:28 UTC (permalink / raw)
To: Alexey Shumkin; +Cc: git
In-Reply-To: <20111010110221.38e9985a@ashu.dyn.rarus.ru>
Alexey Shumkin <Alex.Crezoff@gmail.com> writes:
> As far as cp1251 and UTF-8 files are in different folders,
> it is logically enough to set pattern like
>
> <folder with a UTF-8-xmls>/*.xml diff=utf8-to-cp1251
>
> for the UTF-8 files.
... IN the directory that needs conversion and not in the other one or at
the toplevel. Problem solved, no?
Another idea may be to use "?" in the directory part of the
pattern. Unless the directory structure is sick enough to have these
directory names:
dir-1/utf8-file.xml
dir 1/cp1251-file.xml
dir?1/*.xml would match the matter, so...
^ permalink raw reply
* Re: [PATCH v2] Teach merge the '[-e|--edit]' option
From: Junio C Hamano @ 2011-10-10 15:23 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git, Jay Soffian, Ramkumar Ramachandra
In-Reply-To: <m3ehyl1g5v.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> writes:
> Yet another issue is if we should blindly trust automatic merge resolution.
> It is considered a good practice by some to always check (e.g. by compiling
> and possibly also running tests) the result of merge, whether it required
> merge conflict resolution or not.
>
> IIRC Linus lately said that making "git merge" automatically commit
> was one of bad design decisions of git, for the above reason...
I think your recalling this discussion
http://thread.gmane.org/gmane.linux.kernel/1191100/focus=181362
While I agree with what Linus said in the message, I think you are not
remembering the discussion correctly. It was about bad commit _message_,
and an improvement is not to let users tweak a cleanly automerged result,
but is to allow users or force them to always write their own message,
perhaps with "merge --[no-]edit", which is exactly the point of Jay's
patch in this thread.
^ permalink raw reply
* Git User's Survey 2011 very short summary
From: Jakub Narebski @ 2011-10-10 15:21 UTC (permalink / raw)
To: git
Unfortunately Git Wiki is still down. As soon as possible after it is
up I'll upload results of "Git User's Survey 2011" at
https://git.wiki.kernel.org/index.php/GitSurvey2011
Currently you can download 'Survey results Oct 03, 11.csv.gz', a
compressed CSV file with raw survey data (individual responses), and
'GitSurvey2011_questions.yml' YAML file with question structure from
my repository with script used to analyse survey results:
https://github.com/jnareb/GitSurvey-scripts
You can also view the summary of "Git User's Survey 2011" and
analyse this survey using provided filters at Survs.com:
https://www.survs.com/results/Q5CA9SKQ/P7DE07F0PL
http://tinyurl.com/GitSurvey2011Analysis
..................................................................
Below there is very short summary of some of the results of
"Git User's Survey 2011"
Total responders: 11498 (7177 complete responses i.e. all sections answered,
and 4321 incomplete responses, which gives completion rate of 62%).
About you
^^^^^^^^^
Most responders are from USA among other countries (35%), followed by
Germany, UK, Canada and France (12% to 4%). Most responders are from Europe
among other continents (48%), with North America second (40%).
Most responders are between 26 and 30 years old; most common age (mode)
is 27 years old. Youngest user who answered this question is 11 years
old (next oldest is 12 years old).
820 of Git developers (out of around 910 in all) answered this survey.
This is 9.1% of responders who answered question 'Does Git include
code or documentation by you? (Are you a Git developer?)'.
Getting started with Git
^^^^^^^^^^^^^^^^^^^^^^^^
Responders say that Git is reasonably easy to learn, and easy to
reasonably easy to use; it is easier to use than to learn.
More than 90% use git version 1.7.x at least at one place. There are 5
unfortunate stragglers who use pre 1.3.x version.
Responders fall somewhere between 'everyday use' (36%) and 'can offer
advice' (34%) proficiency.
How you use Git
^^^^^^^^^^^^^^^
Most people (74%) obtain/install Git at least at one place using ready
binary packages.
GNU/Linux dominates among operating systems used (82%), then there is
MacOS X (50%), then MS Windows (where msysGit is 3 to 1 preferred to
Cygwin), with 39%.
Almost 10% of responders use JGit.
62% of responders use some kind of graphical history viewer, and 41%
use Git support integrated with editor/IDE. Graphical diff and
graphical commit tool are used by around 31% of responders.
Most popular feature, by quite a large margin, is *stash*, with two
thirds (69.7%) of responses. "git stash" first appeared in git version
1.5.3, from September 2007.
Second most common used feature is "shell completion of commands", with
half of responses (49.9%).
Then there are, with percentage of responses from 45% to 42%, in
descending order of responders: interactive rebase, aliases (git
aliases, shell aliases, one's own git scripts), and comitting with
dirty tree (keeping some changes uncommitted).
Least used, with only 0.5% of responses, is "git cvsserver" and
"replace mechanism (git replace)".
Most requested features, both with more of 32% responders, are better
support for big files / large media, and support for tracking empty
directories.
Interacting with other repositories
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The leader among git hosting sites is (like in previous years) GitHub
with 87% of responders (up from 77% in 2010 and 62% in 2009); "self
hosted" is second with 38% (down from 44% in 2010 and 57% in 2009),
followed by "company internal" with 31%.
The high position of GitHub migh be at least partially caused by the
fact that GitHub has good announcement system for new features, which
was used to announce "Git User's Survey 2011" to GitHub users.
Most responders do not use paid git hosting (64%); those that pay for
git hosting do it mainly for private repositories (35%).
>From those that self-host git repositories (2932 / 11498) more use
unmaintained(?) Gitosis (36%) than Gitolite (25%).
git:// protocol and SSH have the same popularity for fetching; both
around 76%. Only 46% responders use HTTP for fetching (somewhere).
Deprecated rsync protocol is used only by 20 responders (0.3%).
Other version control systems
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The question about other version control systems was lacking the
"N/A (I use only Git)" answer; in fact presence or absence of N/A
answer is quite inconsistent in this year survey.
Most popular other version contsol systems used alongside or as an
alternative to Git are Subversion (81%), followed after a large gap by
Mercurial (31%).
What do you think of Git
^^^^^^^^^^^^^^^^^^^^^^^^
Most responders are "very happy" with Git, and this answer seems to be a
center of responses.
User interface, documentation and tools need improvement; performance
rather doesn't need to be improved; people mostly don't care about
improving communities or localization (but please remember that this
survey was in English, and announced on English-speaking sites /
lists).
Documentation. Getting and giving help.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most used way to request help about Git (help 'channel') is asking on
StackOverflow or other StackExchange site, with 36% of responders (!),
slightly higher than previous year winner of asking somebody better
versed in Git personally, with 32%.
Note that this year responses will require processing to be able to
compare with results from previous surveys, as in this survey we have
"N/A (didn't request help)" answer with 40% of responses.
On the other hand 72% of responders *gave* help via talk / private
explanation, i.e. answered questions about Git from colleaugue.
Around the same number (about 20%) didn't give help about Git as gave
help via email or instant messaging. Note that only 14% of responders
gave help via StackOverflow or similar site.
--
Jakub Narebski
Poland
^ permalink raw reply
* [PATCH] config: display key_delim for config --bool --get-regexp
From: Matthieu Moy @ 2011-10-10 12:54 UTC (permalink / raw)
To: git, gitster; +Cc: Matthieu Moy
In-Reply-To: <201110101220.21890.brian.foster@maxim-ic.com>
The previous logic in show_config was to print the delimiter when the
value was set, but Boolean variables have an implicit value "true" when
they appear with no value in the config file. As a result, we got:
git_Config --get-regexp '.*\.Boolean' #1. Ok: example.boolean
git_Config --bool --get-regexp '.*\.Boolean' #2. NO: example.booleantrue
Fix this by defering the display of the separator until after the value
to display has been computed.
Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
builtin/config.c | 20 +++++++++++++-------
t/t1300-repo-config.sh | 6 ++++++
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index 0b4ecac..0315ad7 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -99,6 +99,7 @@ static int show_config(const char *key_, const char *value_, void *cb)
const char *vptr = value;
int must_free_vptr = 0;
int dup_error = 0;
+ int must_print_delim = 0;
if (!use_key_regexp && strcmp(key_, key))
return 0;
@@ -109,10 +110,8 @@ static int show_config(const char *key_, const char *value_, void *cb)
return 0;
if (show_keys) {
- if (value_)
- printf("%s%c", key_, key_delim);
- else
- printf("%s", key_);
+ printf("%s", key_);
+ must_print_delim = 1;
}
if (seen && !do_all)
dup_error = 1;
@@ -130,16 +129,23 @@ static int show_config(const char *key_, const char *value_, void *cb)
} else if (types == TYPE_PATH) {
git_config_pathname(&vptr, key_, value_);
must_free_vptr = 1;
+ } else if (value_) {
+ vptr = value_;
+ } else {
+ /* Just show the key name */
+ vptr = "";
+ must_print_delim = 0;
}
- else
- vptr = value_?value_:"";
seen++;
if (dup_error) {
error("More than one value for the key %s: %s",
key_, vptr);
}
- else
+ else {
+ if (must_print_delim)
+ printf("%c", key_delim);
printf("%s%c", vptr, term);
+ }
if (must_free_vptr)
/* If vptr must be freed, it's a pointer to a
* dynamically allocated buffer, it's safe to cast to
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 3e140c1..dffccf8 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -333,6 +333,12 @@ test_expect_success 'get-regexp variable with no value' \
'git config --get-regexp novalue > output &&
cmp output expect'
+echo 'novalue.variable true' > expect
+
+test_expect_success 'get-regexp --bool variable with no value' \
+ 'git config --bool --get-regexp novalue > output &&
+ cmp output expect'
+
echo 'emptyvalue.variable ' > expect
test_expect_success 'get-regexp variable with empty value' \
--
1.7.7.140.ge3099
^ permalink raw reply related
* Re: [BUG 1.7.6.1] `git config --bool --get-regexp' omits separating space... sometimes!
From: Matthieu Moy @ 2011-10-10 12:44 UTC (permalink / raw)
To: Brian Foster; +Cc: git mailing list
In-Reply-To: <201110101220.21890.brian.foster@maxim-ic.com>
Brian Foster <brian.foster@maxim-ic.com> writes:
> example.boolean
> example.booleantrue
There's a problem in
static int show_config(const char *key_, const char *value_, void *cb)
in builtin/config.c. Patch follows.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
* [BUG 1.7.6.1] `git config --bool --get-regexp' omits separating space... sometimes!
From: Brian Foster @ 2011-10-10 10:20 UTC (permalink / raw)
To: git mailing list
Hello,
# Script to illustrate the problem:
rm -f Config
cat <<\EOF >Config
[Example]
Boolean
Other = yes
EOF
git_Config() { git config --file Config "$@"; }
git version
git_Config --get-regexp '.*\.Boolean' #1. ✓ Ok: example.boolean
git_Config --bool --get-regexp '.*\.Boolean' #2. ✗ NO: example.booleantrue
git_Config --get-regexp '.*\.Other' #3. ✓ Ok: example.other yes
git_Config --bool --get-regexp '.*\.Other' #4. ✓ Ok: example.other true
exit
# Output:
git version 1.7.6.1
example.boolean
example.booleantrue
example.other yes
example.other true
Case 2 omits the space between the key-name and (generated) value,
making the output difficult to parse/process. Without checking,
I assume --int (and friends) have a similar bug?
cheers!
-blf-
--
Brian FOSTER
Principal MTS, Software
Maxim Integrated Products (Microcontroller BU), formerly Innova Card
Web : http://www.maxim-ic.com/
^ permalink raw reply
* [PATCH v2 3/7] invalidate_ref_cache(): expose this function in refs API
From: Michael Haggerty @ 2011-10-10 8:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318235064-25915-1-git-send-email-mhagger@alum.mit.edu>
Make invalidate_ref_cache() an official part of the refs API. It is
currently a fact of life that code outside of refs.c mucks about with
references. This change gives such code a way of informing the refs
module that it should no longer trust its cache.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 2 +-
refs.h | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/refs.c b/refs.c
index 89b2a0e..fb46cf5 100644
--- a/refs.c
+++ b/refs.c
@@ -223,7 +223,7 @@ static struct cached_refs *get_cached_refs(const char *submodule)
return refs;
}
-static void invalidate_ref_cache(const char *submodule)
+void invalidate_ref_cache(const char *submodule)
{
clear_cached_refs(get_cached_refs(submodule));
}
diff --git a/refs.h b/refs.h
index 5de06e5..3ddc4e4 100644
--- a/refs.h
+++ b/refs.h
@@ -77,6 +77,14 @@ extern void unlock_ref(struct ref_lock *lock);
/** Writes sha1 into the ref specified by the lock. **/
extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg);
+/*
+ * Invalidate the reference cache for the specified submodule. Use
+ * submodule=NULL to invalidate the cache for the main module. This
+ * function must be called if references are changed via a mechanism
+ * other than the refs API.
+ */
+extern void invalidate_ref_cache(const char *submodule);
+
/** Setup reflog before using. **/
int log_ref_setup(const char *ref_name, char *logfile, int bufsize);
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v2 7/7] clear_cached_refs(): inline function
From: Michael Haggerty @ 2011-10-10 8:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318235064-25915-1-git-send-email-mhagger@alum.mit.edu>
clear_cached_refs() was only called from one place, so inline it
there.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/refs.c b/refs.c
index 01a5958..bf53189 100644
--- a/refs.c
+++ b/refs.c
@@ -191,12 +191,6 @@ static void clear_cached_loose_refs(struct cached_refs *refs)
refs->did_loose = 0;
}
-static void clear_cached_refs(struct cached_refs *refs)
-{
- clear_cached_packed_refs(refs);
- clear_cached_loose_refs(refs);
-}
-
static struct cached_refs *create_cached_refs(const char *submodule)
{
int len;
@@ -237,7 +231,9 @@ static struct cached_refs *get_cached_refs(const char *submodule)
void invalidate_ref_cache(const char *submodule)
{
- clear_cached_refs(get_cached_refs(submodule));
+ struct cached_refs *refs = get_cached_refs(submodule);
+ clear_cached_packed_refs(refs);
+ clear_cached_loose_refs(refs);
}
static struct ref_list *read_packed_refs(FILE *f)
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v2 6/7] write_ref_sha1(): only invalidate the loose ref cache
From: Michael Haggerty @ 2011-10-10 8:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318235064-25915-1-git-send-email-mhagger@alum.mit.edu>
Since write_ref_sha1() can only write loose refs and cannot write
symbolic refs, there is no need for it to invalidate the packed ref
cache.
Suggested by: Martin Fick <mfick@codeaurora.org>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/refs.c b/refs.c
index 6e480ad..01a5958 100644
--- a/refs.c
+++ b/refs.c
@@ -1519,7 +1519,7 @@ int write_ref_sha1(struct ref_lock *lock,
unlock_ref(lock);
return -1;
}
- invalidate_ref_cache(NULL);
+ clear_cached_loose_refs(get_cached_refs(NULL));
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v2 5/7] clear_cached_refs(): extract two new functions
From: Michael Haggerty @ 2011-10-10 8:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318235064-25915-1-git-send-email-mhagger@alum.mit.edu>
Extract two new functions from clear_cached_refs():
clear_loose_ref_cache() and clear_packed_ref_cache().
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/refs.c b/refs.c
index 9f004ce..6e480ad 100644
--- a/refs.c
+++ b/refs.c
@@ -175,14 +175,26 @@ static void free_ref_list(struct ref_list *list)
}
}
-static void clear_cached_refs(struct cached_refs *refs)
+static void clear_cached_packed_refs(struct cached_refs *refs)
{
- if (refs->did_loose && refs->loose)
- free_ref_list(refs->loose);
if (refs->did_packed && refs->packed)
free_ref_list(refs->packed);
- refs->loose = refs->packed = NULL;
- refs->did_loose = refs->did_packed = 0;
+ refs->packed = NULL;
+ refs->did_packed = 0;
+}
+
+static void clear_cached_loose_refs(struct cached_refs *refs)
+{
+ if (refs->did_loose && refs->loose)
+ free_ref_list(refs->loose);
+ refs->loose = NULL;
+ refs->did_loose = 0;
+}
+
+static void clear_cached_refs(struct cached_refs *refs)
+{
+ clear_cached_packed_refs(refs);
+ clear_cached_loose_refs(refs);
}
static struct cached_refs *create_cached_refs(const char *submodule)
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v2 2/7] invalidate_ref_cache(): take the submodule as parameter
From: Michael Haggerty @ 2011-10-10 8:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318235064-25915-1-git-send-email-mhagger@alum.mit.edu>
Instead of invalidating the ref cache on an all-or-nothing basis,
allow the cache for individual submodules to be invalidated.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/refs.c b/refs.c
index 56e4254..89b2a0e 100644
--- a/refs.c
+++ b/refs.c
@@ -223,13 +223,9 @@ static struct cached_refs *get_cached_refs(const char *submodule)
return refs;
}
-static void invalidate_ref_cache(void)
+static void invalidate_ref_cache(const char *submodule)
{
- struct cached_refs *refs = cached_refs;
- while (refs) {
- clear_cached_refs(refs);
- refs = refs->next;
- }
+ clear_cached_refs(get_cached_refs(submodule));
}
static struct ref_list *read_packed_refs(FILE *f)
@@ -1212,7 +1208,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
ret |= repack_without_ref(refname);
unlink_or_warn(git_path("logs/%s", lock->ref_name));
- invalidate_ref_cache();
+ invalidate_ref_cache(NULL);
unlock_ref(lock);
return ret;
}
@@ -1511,7 +1507,7 @@ int write_ref_sha1(struct ref_lock *lock,
unlock_ref(lock);
return -1;
}
- invalidate_ref_cache();
+ invalidate_ref_cache(NULL);
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v2 4/7] clear_cached_refs(): rename parameter
From: Michael Haggerty @ 2011-10-10 8:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318235064-25915-1-git-send-email-mhagger@alum.mit.edu>
...for consistency with the rest of this module.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/refs.c b/refs.c
index fb46cf5..9f004ce 100644
--- a/refs.c
+++ b/refs.c
@@ -175,14 +175,14 @@ static void free_ref_list(struct ref_list *list)
}
}
-static void clear_cached_refs(struct cached_refs *ca)
+static void clear_cached_refs(struct cached_refs *refs)
{
- if (ca->did_loose && ca->loose)
- free_ref_list(ca->loose);
- if (ca->did_packed && ca->packed)
- free_ref_list(ca->packed);
- ca->loose = ca->packed = NULL;
- ca->did_loose = ca->did_packed = 0;
+ if (refs->did_loose && refs->loose)
+ free_ref_list(refs->loose);
+ if (refs->did_packed && refs->packed)
+ free_ref_list(refs->packed);
+ refs->loose = refs->packed = NULL;
+ refs->did_loose = refs->did_packed = 0;
}
static struct cached_refs *create_cached_refs(const char *submodule)
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v2 1/7] invalidate_ref_cache(): rename function from invalidate_cached_refs()
From: Michael Haggerty @ 2011-10-10 8:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318235064-25915-1-git-send-email-mhagger@alum.mit.edu>
It is the cache that is being invalidated, not the references.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/refs.c b/refs.c
index 2cb93e2..56e4254 100644
--- a/refs.c
+++ b/refs.c
@@ -223,7 +223,7 @@ static struct cached_refs *get_cached_refs(const char *submodule)
return refs;
}
-static void invalidate_cached_refs(void)
+static void invalidate_ref_cache(void)
{
struct cached_refs *refs = cached_refs;
while (refs) {
@@ -1212,7 +1212,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
ret |= repack_without_ref(refname);
unlink_or_warn(git_path("logs/%s", lock->ref_name));
- invalidate_cached_refs();
+ invalidate_ref_cache();
unlock_ref(lock);
return ret;
}
@@ -1511,7 +1511,7 @@ int write_ref_sha1(struct ref_lock *lock,
unlock_ref(lock);
return -1;
}
- invalidate_cached_refs();
+ invalidate_ref_cache();
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v2 0/7] Provide API to invalidate refs cache
From: Michael Haggerty @ 2011-10-10 8:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318225574-18785-1-git-send-email-mhagger@alum.mit.edu>
Sorry for superseding my own patch series, but I prefer this patch
series to the one that I submitted earlier today:
1. An API function deserves a more carefully-selected name:
invalidate_ref_cache().
2. It gives me a chance to submit the first "bite" of my scalable-refs
changes.
These patches apply on top of mh/iterate-refs, which is in next but
not in master.
This patch series provides an API for external code to invalidate the
ref cache that is used internally to refs.c. It also allows code
*within* refs.c to invalidate only the packed or only the loose refs
for a module/submodule.
IMPORTANT:
I won't myself have time to figure out who, outside of refs.c, has to
*call* invalidate_ref_cache(). The candidates that I know off the top
of my head are git-clone, git-submodule, and git-pack-refs. It would
be great if experts in those areas would insert calls to
invalidate_ref_cache() where needed.
Even better would be if the meddlesome code were changed to use the
refs API. I'd be happy to help expanding the refs API if needed to
accommodate your needs.
This is why the API for invalidating only packed or loose refs is
private. After code outside refs.c is changed to use the refs API, it
will get the optimal behavior for free (and at that time
invalidate_ref_cache() can be removed again).
Michael Haggerty (7):
invalidate_ref_cache(): rename function from invalidate_cached_refs()
invalidate_ref_cache(): take the submodule as parameter
invalidate_ref_cache(): expose this function in refs API
clear_cached_refs(): rename parameter
clear_cached_refs(): extract two new functions
write_ref_sha1(): only invalidate the loose ref cache
clear_cached_refs(): inline function
refs.c | 34 +++++++++++++++++++---------------
refs.h | 8 ++++++++
2 files changed, 27 insertions(+), 15 deletions(-)
--
1.7.7.rc2
^ permalink raw reply
* Re: [PATCH v2] Teach merge the '[-e|--edit]' option
From: Matthieu Moy @ 2011-10-10 7:50 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Junio C Hamano, git, Jay Soffian, Ramkumar Ramachandra
In-Reply-To: <m3ehyl1g5v.fsf@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> writes:
> Yet another issue is if we should blindly trust automatic merge resolution.
> It is considered a good practice by some to always check (e.g. by compiling
> and possibly also running tests) the result of merge, whether it required
> merge conflict resolution or not.
I agree that trusting merge blindly is bad, but still, if there are no
merge conflicts, and if the merge is broken, I'd prefer commiting a
fixup patch right after the merge than fixing it before committing.
Because if the merge needs a fix, it usually means something tricky that
deserves its own patch and commit message. At worse, one can still reset
--merge HEAD^.
One other issue with not committing automatically is for beginners. I
see that all the time when the merge has conflicts. newbies fix the
conflicts, and when they're done: "fine, conflicts solved, let's
continue hacking" without committing. The resulting history is totally
messy because it mixes merges and actual edits. For these users, not
committing automatically in the absence of conflict would make the
situation even worse.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
* Re: [PATCH v2] Teach merge the '[-e|--edit]' option
From: Jakub Narebski @ 2011-10-10 7:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jay Soffian, Ramkumar Ramachandra
In-Reply-To: <7vr52lo1m3.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> By the way, on the other side of this same coin lies another use case
> (different from the one in the footnote in the previous message) for
> "merge --no-commit". When you know that a particular merge _will_ need
> semantic adjustments, even if it were to textually merge cleanly, you
> would want the command to ask you for help to come up with the final tree,
> instead of trusting the clean automerge result. This often happens when
> the topic branch you are about to merge has changed the semantics of an
> existing function (e.g. adding a new parameter) while the branch you are
> on has added new callsite to the function (or the other way around). In
> such a merge, you would need to adjust the new callsite that does not know
> about the additional parameter to the new function signature. For exactly
> the same reason, it is not a kosher advice to give to users of modern Git
> to "interfere with the merge with 'merge --no-commit', and then conclude
> with 'commit'", as 'commit' has less information than 'merge' itself what
> 'merge' wants to do in addition to recording the result as a 'commit'.
Yet another issue is if we should blindly trust automatic merge resolution.
It is considered a good practice by some to always check (e.g. by compiling
and possibly also running tests) the result of merge, whether it required
merge conflict resolution or not.
IIRC Linus lately said that making "git merge" automatically commit
was one of bad design decisions of git, for the above reason...
--
Jakub Narębski
^ permalink raw reply
* Git bug. gitattributes' pattern does not respect spaces in the filenames
From: Alexey Shumkin @ 2011-10-10 7:02 UTC (permalink / raw)
To: git
Hello everyone!
There's a description for the understanding of a
situation.
I have a project on Windows. I use Git under Cygwin.
There are some *.xml in the project. But some of them are in cp1251
encoding, another ones are in UTF-8. For the first ones there is no
need of any conversion to see the git-diff, but for the *.xml's in UTF-8
I set
*.xml diff=utf8-to-cp1251
And according to this I have
$ git config diff.utf8-to-cp1251.textconv 'iconv -f utf-8 -t cp1251'
Unfortunately, *.xml's in cp1251 DOES match this pattern, too.
As far as cp1251 and UTF-8 files are in different folders,
it is logically enough to set pattern like
<folder with a UTF-8-xmls>/*.xml diff=utf8-to-cp1251
for the UTF-8 files.
BUT!
Unfortunately, <folder with a UTF-8-xmls> have spaces in its name,
so textconv filter does not work because of error of
parsing .gitattributes
I have no enough skills to patch Git to fix this error.
Is anybody interested in to do?
Thanks
^ permalink raw reply
* Re: [PATCH] commit: teach --gpg-sign option
From: Michael J Gruber @ 2011-10-10 6:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v4nzhrebp.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 10.10.2011 00:27:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
>> BTW: commit --amend --gpg-sign strips an existing signature rather than
>> adding one. We might want the user to have a say here.
>
> I think it deserves a separate command (commit --add-gpg-sign) that is
> used _only_ to add an additional signature by another person without
> affecting anything else in the commit (i.e. the tree, the parents and the
> author and committership information) from the viewpoint of the workflow,
Agreed, as I asked "the user to have a say".
> Obviously that "add-signature" mode needs to be aware of the existing
> signature. It is a deliberate design decision to strip existing signature
> when anything in the commit changes, which is the norm for --amend.
What norm? --amend keeps some header fields and discards others. In
fact, signing a commit "without changing it" (i.e. keeping tree, parents
etc., alias "--amend -C HEAD") should be the normal use case for signing
the tip of an existing branch. I mean, I have no problems adding to this:
git help fixup
`git fixup' is aliased to `commit --amend -C HEAD'
But what is the best default for the workflows that we encourage (commit
early, ...)? You answer a pull-request which happens to be a
fast-forward, sign the tip and suddenly you've taken over ownership (and
changed dates)??? Signing a commit should not do this.
Michael
^ permalink raw reply
* Re: [PATCH] commit: teach --gpg-sign option
From: Michael J Gruber @ 2011-10-10 6:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v8votrhbr.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 09.10.2011 23:22:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
>
>> I just noticed that this format differs from the one of signed
>> tags. What special reason is there for the "sig " indentation?
>
> Read the part of the message you are quoting.
I certainly did, and certainly did not find any mention. Do you think I
would have asked otherwise? I'm trying to be helpful by testing out a
patch in flight. That is: *I* am trying to be helpful.
This
> The lines of GPG detached signature are placed in new header lines, after
> the standard tree/parent/author/committer headers, instead of tucking the
> signature block at the end of the commit log message text (similar to how
> signed tag is done), for multiple reasons:
gave me the impression that commit signatures are done "similar to how
signed tag is done".
*After* doing several "cat-file" and after your insisting that you had
described the "sig " indent I come to the conclusion that you
implemented it this way "instead of... [doing it] similar to how signed
tag is done".
Before that, I misread those paragraphs (togetheter with the
non-existing object format doc) to mean that have a section in the
object which is ignored automatically, which is where tag signatures are
(while in fact they are not) and where commit signatures will go.
I have to say I dislike the fact that we would have different signature
formats. But I have spent too much time on this unnecessarily already.
Michael
^ permalink raw reply
* [PATCH 2/2] invalidate_cached_refs(): expose this function in refs API
From: Michael Haggerty @ 2011-10-10 5:46 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318225574-18785-1-git-send-email-mhagger@alum.mit.edu>
Make invalidate_cached_refs() an official part of the refs API. It is
currently a fact of life that code outside of refs.c mucks about with
references. This change gives such code a way of informing the refs
module that it should no longer trust its cache.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 2 +-
refs.h | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/refs.c b/refs.c
index 49b73c4..0483ecc 100644
--- a/refs.c
+++ b/refs.c
@@ -223,7 +223,7 @@ static struct cached_refs *get_cached_refs(const char *submodule)
return refs;
}
-static void invalidate_cached_refs(const char *submodule)
+void invalidate_cached_refs(const char *submodule)
{
clear_cached_refs(get_cached_refs(submodule));
}
diff --git a/refs.h b/refs.h
index 5de06e5..63dc68c 100644
--- a/refs.h
+++ b/refs.h
@@ -77,6 +77,14 @@ extern void unlock_ref(struct ref_lock *lock);
/** Writes sha1 into the ref specified by the lock. **/
extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg);
+/*
+ * Invalidate the reference cache for the specified submodule. Use
+ * submodule=NULL to invalidate the cache for the main module. This
+ * function must be called if references are changed via a mechanism
+ * other than the refs API.
+ */
+extern void invalidate_cached_refs(const char *submodule);
+
/** Setup reflog before using. **/
int log_ref_setup(const char *ref_name, char *logfile, int bufsize);
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH 1/2] invalidate_cached_refs(): take the submodule as parameter
From: Michael Haggerty @ 2011-10-10 5:46 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <1318225574-18785-1-git-send-email-mhagger@alum.mit.edu>
Instead of invalidating the refs cache on an all-or-nothing basis,
allow the cache for individual submodules to be invalidated.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/refs.c b/refs.c
index 2cb93e2..49b73c4 100644
--- a/refs.c
+++ b/refs.c
@@ -223,13 +223,9 @@ static struct cached_refs *get_cached_refs(const char *submodule)
return refs;
}
-static void invalidate_cached_refs(void)
+static void invalidate_cached_refs(const char *submodule)
{
- struct cached_refs *refs = cached_refs;
- while (refs) {
- clear_cached_refs(refs);
- refs = refs->next;
- }
+ clear_cached_refs(get_cached_refs(submodule));
}
static struct ref_list *read_packed_refs(FILE *f)
@@ -1212,7 +1208,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
ret |= repack_without_ref(refname);
unlink_or_warn(git_path("logs/%s", lock->ref_name));
- invalidate_cached_refs();
+ invalidate_cached_refs(NULL);
unlock_ref(lock);
return ret;
}
@@ -1511,7 +1507,7 @@ int write_ref_sha1(struct ref_lock *lock,
unlock_ref(lock);
return -1;
}
- invalidate_cached_refs();
+ invalidate_cached_refs(NULL);
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH 0/2] Provide API to invalidate refs cache
From: Michael Haggerty @ 2011-10-10 5:46 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Michael Haggerty
In-Reply-To: <7v39f2rko5.fsf@alter.siamese.dyndns.org>
I am happy to provide the API; see the following patches.
But I won't have time to figure out who, outside of refs.c, has to
*call* invalidate_cached_refs(). The candidates that I know off the
top of my head are git-clone, git-submodule, and git-pack-refs. It
would be great if experts in those areas would insert calls to
invalidate_cached_refs() where needed.
Even better would be if the meddlesome code were changed to use the
refs API. I'd be happy to help expanding the refs API if needed to
accommodate your needs.
Michael Haggerty (2):
invalidate_cached_refs(): take the submodule as parameter
invalidate_cached_refs(): expose this function in refs API
refs.c | 12 ++++--------
refs.h | 8 ++++++++
2 files changed, 12 insertions(+), 8 deletions(-)
--
1.7.7.rc2
^ permalink raw reply
* Re: [PATCH v2] Teach merge the '[-e|--edit]' option
From: Junio C Hamano @ 2011-10-10 5:29 UTC (permalink / raw)
To: git; +Cc: Jay Soffian, Ramkumar Ramachandra
In-Reply-To: <7v8votpx4n.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> To understand why it is a wrong mental model, you need to imagine a world
> where the logic to resolve conflicts in "git merge" is improved so that it
> needs less help from the users. rerere.autoupdate is half-way there---the
> user allows the merge machinery to take advantage of conflict resolutions
> that the user has performed previously. Even though we currently do not
> let "git merge" proceed to commit the result, it is entirely plausible to
> go one step further and treat the resulting tree from applying the rerere
> information as the result of the automerge. When that happens, it is very
> natural for the user to expect that the rest of what "git merge" does for
> a clean automerge to be carried out. After all, from the end user's point
> of view, it _is_ a clean auto-merge. The only difference is how the user
> helped the automerge machinery.
Addendum.
I am not suggesting that we should change rerere.autoupdate to go all the
way and record a merge commit by default automatically when rerere applies
cleanly.
I personally think that it is a sensible default to set rerere.autoupdate
to false (or not to set the variable at all) to ensure that a merge that
conflicts is always inspected by the end user, given that rerere is merely
a heuristic (even though it is a damn good one) and produces a surprising
result.
But that is a policy preference; some people want to trust rerere more
than I do and that is a valid choice for them to make. To support such a
policy preference, I am perfectly fine with introducing a third value to
rerere.autoupdate in addition to yes/no to allow commands (e.g. "merge",
"am", etc.) to continue when rerere resolved conflicts cleanly in a
situation where they would have stopped and asked user to help resolving.
By the way, on the other side of this same coin lies another use case
(different from the one in the footnote in the previous message) for
"merge --no-commit". When you know that a particular merge _will_ need
semantic adjustments, even if it were to textually merge cleanly, you
would want the command to ask you for help to come up with the final tree,
instead of trusting the clean automerge result. This often happens when
the topic branch you are about to merge has changed the semantics of an
existing function (e.g. adding a new parameter) while the branch you are
on has added new callsite to the function (or the other way around). In
such a merge, you would need to adjust the new callsite that does not know
about the additional parameter to the new function signature. For exactly
the same reason, it is not a kosher advice to give to users of modern Git
to "interfere with the merge with 'merge --no-commit', and then conclude
with 'commit'", as 'commit' has less information than 'merge' itself what
'merge' wants to do in addition to recording the result as a 'commit'.
Either the 'commit' command needs to detect that it is conclusing the
merge and trigger the merge hooks the same way as 'merge' itself does,
(which is a bad design, as 'commit' will need to know about the clean-up
operations of all the other commands that may ask users to help and let
'commit' conclude it), or the end user instruction needs to be updated so
that 'merge --continue' is used in such a situation to give 'merge' a
chance to finish up. Again we could have "git continue" wrapper that knows
how to tell what operation was in progress and invokes "merge --continue"
when it detects that it was a 'merge' that was in progress, but that is a
mere fluff.
^ permalink raw reply
* Re: [PATCH] commit: teach --gpg-sign option
From: Junio C Hamano @ 2011-10-10 4:58 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: git
In-Reply-To: <CACBZZX6xsnAv4S8zAqi08bcqrghZ8nKdzFP=UNCqZOqrEeLFnA@mail.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> A nit: no other commit header is an abbreviation, it would be more
> consistent to use "signature" instead of "sig".
You are probably right.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox