[git-users] Re: Query on git submodules

2015-06-02 Thread Thomas Ferris Nicolaisen
On Thursday, May 28, 2015 at 1:45:33 PM UTC+2, Mattias Vannergård wrote:

 Hi!


Note that this topic continued on the Git mailing list here: 

http://comments.gmane.org/gmane.comp.version-control.git/269716

Mattias, perhaps you should post your reply there as well. 

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Some clarification on what Git is actually doing, please

2015-06-02 Thread Magnus Therning
On 1 June 2015 at 20:12, Tim Dawson trhdaw...@gmail.com wrote:
 Thank you, Konstantin.

 That's quite a lot to take in with one read-through, so I'll study it more
 carefully as I go forward.
 I'm finding Git a whole lot better than giving files slightly different
 names and trying to remember which one went with another!

Yes, read about it and use it.  That's a good way to learn :)  Also,
if you are curious about stuff surrounding git I can recommend [git
minutes](http://www.gitminutes.com/).

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Deploying a static website to local and production servers

2015-06-02 Thread Márcio Moreira
Konstantin,

Thank you for your answer. I am now studying all you said.

I am sorry I forgot to say previously that Pelican runs on the 
collaborators laptops. The versioned folder already includes source, 
output, and other sub-folders and files. The workflow: our collaborator 
will edit the source files; run pelican to generate the output files; 
verify the output files using a browser; and, after confirm everything is 
OK, he/she will commit the changes and push them to our local server 
(origin). 

We need to version control and store on the local server the files already 
available on the laptops.

What we are looking for is a way to copy one of the versioned sub-folders 
(named output) from local server (origin) to another server (webhosting), 
making use of post-update, when origin is updated.

Git , version control, and english, are still a bit mysterious to me and 
sometimes I can´t find the words. I hope you understand.

Greetings,
Marcio

Em terça-feira, 2 de junho de 2015 12:09:58 UTC-3, Konstantin Khomoutov 
escreveu:

 On Tue, 2 Jun 2015 07:26:54 -0700 (PDT) 
 Márcio Moreira mar...@verdesaine.net javascript: wrote: 

  We are using Pelican, a static site generator, to generate our web 
  site. We write markdown formatted text files to a content folder 
  and Pelican generates HTML files to an output folder. 
  
  Our goal is that the site could be edited by some collaborators 
  sharing its work through a repository on our local linux server. 
  Every time a commit is pushed to the local server, we wish the output 
  folder (or the complete working dir) is pushed  to another server, a 
  production web hosting server: 
  
  - Laptop A: complete working copy. 
  - Laptop B: complete working copy. 
  - Local Server: complete working copy for backup and centralized 
  repository. 
  - Web Hosting Server: only the output folder content (or complete 
  working copy, if we can´t send only the output folder). 
  
  My question is how to setup the post-receive hook on local server to 
  push the output folder to the web hosting server. 
  
  I have been following some posts on the web. They all set local 
  server as a bare repository, but I need it to host the complete 
  project: source and output files. It seems to me that a bare 
  repository can´t act as central repository for collaborators. Is it 
  right? 

 OK, let's digest this piecemeal. 

 First, you appear to make a false connection between your output 
 directory and the type of the shared/public Git repository. 
 Git in either setup does now know about this directory -- that 
 knowledge belongs only in your static website generator. 

 Now what you really want to have is a way to check the files present in 
 some revision of interest to some place where Pelican can pick them up. 
 With a normal (non-bare) Git repository you get this sort of for free: 
 by means of having the work tree naturally coupled to the repository 
 itself. 

 But that's not required for having your files checked out.  90% of 
 random HOWTOs you're able to google using git+web+deployment explain 
 exactly this scenario: there's only a bare repository on the target 
 server, and the files from the tip commit among those just pushed 
 get checked out to some arbitrary directory.  Most of the time this is 
 done via environment variables, namely, GIT_DIR, GIT_WORK_TREE and 
 GIT_INDEX_FILE environment variables.  POSIX shell pseudocode for a 
 post-receive hook: 

 ---8--- 
   #!/bin/sh 
   
   set -e -u 
   
   GIT_DIR=/path/to/your/repo/on/the/server 
   GIT_WORK_TREE=`mktemp -d /tmp/siteXXX` 
   trap rm -rf '$GIT_WORK_TREE' TERM INT EXIT 
   GIT_INDEX_FILE=$GIT_WORK_TREE/.gitindex 
   
   export GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE 
   git read-tree master 
   git checkout-tree -a 
   
   pelican --srcdir=$GIT_WORK_TREE --outdir /path/to/output/dir 
 ---8--- 

 The script rolls like this: 
 1) Sets GIT_DIR to the path of your repo. 
 2) Creates a temporary directory for the files to be checked out. 
And immediately arranges for it to be removed when the script 
is terminated or exits. 
The name of this directory is assigned to GIT_WORK_TREE. 
 2) Make up GIT_INDEX_FILE variable pointing to a non-existing 
file under our artifical work tree.  That's fine unless 
the name clashes with some existing file. 
 3) All these variables are then exported -- in order for the 
git programs called afterwards to see them. 
 4) The tip revision on master is read into the index. 
 5) The information from the index is checked out to the 
work tree. 
 6) Pelican runs. 
 7) The script exits and our temporary work tree gets deleted. 

 Sure, there are other ways to do this.  If your web site is huge, 
 you can make your work tree persistent and use the correct keys to 
 `git checkout-tree` to make it play well with the files already there. 

 One last note on hooks: the hook you want to use is supposedly 
 post-update, not post-receive.  An error in 

Re: [git-users] Avoid EOL hell

2015-06-02 Thread Nelson Efrain A. Cruz
Y prefer to ensure that everyone uses Linux EOL, but that's not an easy
task.

El mar, jun 2, 2015 14:37, Konstantin Khomoutov 
flatw...@users.sourceforge.net escribió:

 On Tue, 2 Jun 2015 22:09:46 +0530
 Rustom Mody rustompm...@gmail.com wrote:

  Setting up for a project in which both linux and windows will be the
  OSes.
 
  After spending some time searching for solutions I am as confused as
  ever. What are the optimum crlf settings so that files (maybe of
  designated types, say
  .c and .h files) are CRLF on windows and LF on linux?

 I recommend reading through [1].

 In short, core.autocrlf set to auto on Windows should, in theory,
 ensure that the text files have CRLF EOLs in the work tree and LFs
 in the index and the object store.  But that's, well, in theory, and
 you might need to cater for the bogosity of particular tools.

 (I'm assuming you're using Git for Windows on Windows.  Cygwin's Git
 lives in its own POSIX-y world and considers LFs to be the platform's
 native EOLs.  The installer of GfW sets core.autocrlf to auto
 by default, and, AFAIK, there's no way to tell it not to.)

 1. https://github.com/mono/mono/blob/master/.gitattributes

 --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to git-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Some clarification on what Git is actually doing, please

2015-06-02 Thread Konstantin Khomoutov
On Tue, 2 Jun 2015 09:32:35 +0200
Magnus Therning mag...@therning.org wrote:

  That's quite a lot to take in with one read-through, so I'll study
  it more carefully as I go forward.
  I'm finding Git a whole lot better than giving files slightly
  different names and trying to remember which one went with another!
 
 Yes, read about it and use it.  That's a good way to learn :)  Also,
 if you are curious about stuff surrounding git I can recommend [git
 minutes](http://www.gitminutes.com/).

I would also recommend The Git Parable [1] -- it's fun to read but
provides a good insight on how data is actually managed by a DVCS.

1. http://tom.preston-werner.com/2009/05/19/the-git-parable.html

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Deploying a static website to local and production servers

2015-06-02 Thread Márcio Moreira
Hello,

We are using Pelican, a static site generator, to generate our web site. We 
write markdown formatted text files to a content folder and Pelican 
generates HTML files to an output folder. 

Our goal is that the site could be edited by some collaborators sharing its 
work through a repository on our local linux server. Every time a commit is 
pushed to the local server, we wish the output folder (or the complete 
working dir) is pushed  to another server, a production web hosting server:

- Laptop A: complete working copy.
- Laptop B: complete working copy.
- Local Server: complete working copy for backup and centralized repository.
- Web Hosting Server: only the output folder content (or complete working 
copy, if we can´t send only the output folder).

My question is how to setup the post-receive hook on local server to push 
the output folder to the web hosting server.

I have been following some posts on the web. They all set local server as a 
bare repository, but I need it to host the complete project: source and 
output files. It seems to me that a bare repository can´t act as central 
repository for collaborators. Is it right?

Anyway, every advice is welcome.

Thank you,
Marcio

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] branching in a distributed environment

2015-06-02 Thread Konstantin Khomoutov
On Tue, 2 Jun 2015 16:08:24 +0200
Magnus Therning mag...@therning.org wrote:

  [...]
  at the next `git fetch` people will see that branch locally and
  they can check it out using
 
  % git checkout -b temporary origin/temporary
  [...]
 
  As a useful shortcut, these days
 
git checkout origin/temporary
 
  will create a local branch named temporary which is set to track
  origin/temporary.
 
  Of course, this shortcut is only to be used by those who understand
  what happens, and why.
 
 This exemplifies the main issue with `git` I think: the developers
 keep on improving on the UI without telling me! ;)

Oops, I actually disinformed you: the correct command would be

  git checkout temporary

That is, if a local branch with that name does not exist but there is a
remote-tracking branch with such name, but only in a single remote
(that is, there is no ambiguity), the command behaves as I outlined
above.  Sorry for the confusion.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] branching in a distributed environment

2015-06-02 Thread Konstantin Khomoutov
On Tue, 2 Jun 2015 15:37:33 +0200
Magnus Therning mag...@therning.org wrote:

[...]
 at the next `git fetch` people will see that branch locally and they
 can check it out using
 
 % git checkout -b temporary origin/temporary
[...]

As a useful shortcut, these days

  git checkout origin/temporary

will create a local branch named temporary which is set to track
origin/temporary.

Of course, this shortcut is only to be used by those who understand
what happens, and why.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] branching in a distributed environment

2015-06-02 Thread Magnus Therning
On 2 June 2015 at 15:56, Konstantin Khomoutov
flatw...@users.sourceforge.net wrote:
 On Tue, 2 Jun 2015 15:37:33 +0200
 Magnus Therning mag...@therning.org wrote:

 [...]
 at the next `git fetch` people will see that branch locally and they
 can check it out using

 % git checkout -b temporary origin/temporary
 [...]

 As a useful shortcut, these days

   git checkout origin/temporary

 will create a local branch named temporary which is set to track
 origin/temporary.

 Of course, this shortcut is only to be used by those who understand
 what happens, and why.

This exemplifies the main issue with `git

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] branching in a distributed environment

2015-06-02 Thread Magnus Therning
On 2 June 2015 at 15:56, Konstantin Khomoutov
flatw...@users.sourceforge.net wrote:
 On Tue, 2 Jun 2015 15:37:33 +0200
 Magnus Therning mag...@therning.org wrote:

 [...]
 at the next `git fetch` people will see that branch locally and they
 can check it out using

 % git checkout -b temporary origin/temporary
 [...]

 As a useful shortcut, these days

   git checkout origin/temporary

 will create a local branch named temporary which is set to track
 origin/temporary.

 Of course, this shortcut is only to be used by those who understand
 what happens, and why.

This exemplifies the main issue with `git` I think: the developers
keep on improving on the UI without telling me! ;)

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] branching in a distributed environment

2015-06-02 Thread Jay Braun
A colleague in another city and I are working on the same project, with a 
GitHub repository to synch up, i.e., we push to, and pull/fetch from the 
remote GitHub repository.

I created a branch the other day.  Let's say I was in 'maintrunk'.  I 
entered:

git checkout -b temporary

and made some changes in 'temporary' which is a terminal branch to support 
a specific temporary usage. 

From this point, 1) what is the simplest way for me to get the GitHub repo 
synched with 'temporary' and 2) what is the simplest way for him to bring 
over 'temporary' without touching his local version of 'maintrunk'?  For 
example, at what point should he do a 'git checkout'?  Should he do a 'git 
checkout -b' to create the new branch in his local repo, or rely on a fetch 
or pull?

Jay

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] branching in a distributed environment

2015-06-02 Thread Magnus Therning
On 2 June 2015 at 15:25, Jay Braun lyngw...@gmail.com wrote:
 A colleague in another city and I are working on the same project, with a
 GitHub repository to synch up, i.e., we push to, and pull/fetch from the
 remote GitHub repository.

 I created a branch the other day.  Let's say I was in 'maintrunk'.  I
 entered:

 git checkout -b temporary

 and made some changes in 'temporary' which is a terminal branch to support a
 specific temporary usage.

 From this point, 1) what is the simplest way for me to get the GitHub repo
 synched with 'temporary' and 2) what is the simplest way for him to bring
 over 'temporary' without touching his local version of 'maintrunk'?  For
 example, at what point should he do a 'git checkout'?  Should he do a 'git
 checkout -b' to create the new branch in his local repo, or rely on a fetch
 or pull?

It sounds like you want to expose the new branch to him so then you use `push`:

% git push origin temporary

at the next `git fetch` people will see that branch locally and they
can check it out using

% git checkout -b temporary origin/temporary

If you don't want to expose the branch itself you can simply merge it
locally to `master` and then push it:

% git co master
% git merge temporary
% git push

Other's will see that change just as normal, but won't know that you
ever had a branch named `temporary`.  If they use `git fetch` they
will see your changes, but not merge them in (`git pull` is basically
a `git fetch` followed by a `git merge`).

Hope that answers your questions.

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Deploying a static website to local and production servers

2015-06-02 Thread Konstantin Khomoutov
On Tue, 2 Jun 2015 07:26:54 -0700 (PDT)
Márcio Moreira mar...@verdesaine.net wrote:

 We are using Pelican, a static site generator, to generate our web
 site. We write markdown formatted text files to a content folder
 and Pelican generates HTML files to an output folder. 
 
 Our goal is that the site could be edited by some collaborators
 sharing its work through a repository on our local linux server.
 Every time a commit is pushed to the local server, we wish the output
 folder (or the complete working dir) is pushed  to another server, a
 production web hosting server:
 
 - Laptop A: complete working copy.
 - Laptop B: complete working copy.
 - Local Server: complete working copy for backup and centralized
 repository.
 - Web Hosting Server: only the output folder content (or complete
 working copy, if we can´t send only the output folder).
 
 My question is how to setup the post-receive hook on local server to
 push the output folder to the web hosting server.
 
 I have been following some posts on the web. They all set local
 server as a bare repository, but I need it to host the complete
 project: source and output files. It seems to me that a bare
 repository can´t act as central repository for collaborators. Is it
 right?

OK, let's digest this piecemeal.

First, you appear to make a false connection between your output
directory and the type of the shared/public Git repository.
Git in either setup does now know about this directory -- that
knowledge belongs only in your static website generator.

Now what you really want to have is a way to check the files present in
some revision of interest to some place where Pelican can pick them up.
With a normal (non-bare) Git repository you get this sort of for free:
by means of having the work tree naturally coupled to the repository
itself.

But that's not required for having your files checked out.  90% of
random HOWTOs you're able to google using git+web+deployment explain
exactly this scenario: there's only a bare repository on the target
server, and the files from the tip commit among those just pushed
get checked out to some arbitrary directory.  Most of the time this is
done via environment variables, namely, GIT_DIR, GIT_WORK_TREE and
GIT_INDEX_FILE environment variables.  POSIX shell pseudocode for a
post-receive hook:

---8---
  #!/bin/sh
  
  set -e -u
  
  GIT_DIR=/path/to/your/repo/on/the/server
  GIT_WORK_TREE=`mktemp -d /tmp/siteXXX`
  trap rm -rf '$GIT_WORK_TREE' TERM INT EXIT
  GIT_INDEX_FILE=$GIT_WORK_TREE/.gitindex
  
  export GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
  git read-tree master
  git checkout-tree -a
  
  pelican --srcdir=$GIT_WORK_TREE --outdir /path/to/output/dir
---8---

The script rolls like this:
1) Sets GIT_DIR to the path of your repo.
2) Creates a temporary directory for the files to be checked out.
   And immediately arranges for it to be removed when the script
   is terminated or exits.
   The name of this directory is assigned to GIT_WORK_TREE.
2) Make up GIT_INDEX_FILE variable pointing to a non-existing
   file under our artifical work tree.  That's fine unless
   the name clashes with some existing file.
3) All these variables are then exported -- in order for the
   git programs called afterwards to see them.
4) The tip revision on master is read into the index.
5) The information from the index is checked out to the
   work tree.
6) Pelican runs.
7) The script exits and our temporary work tree gets deleted.

Sure, there are other ways to do this.  If your web site is huge,
you can make your work tree persistent and use the correct keys to
`git checkout-tree` to make it play well with the files already there.

One last note on hooks: the hook you want to use is supposedly
post-update, not post-receive.  An error in the latter kind of hook
aborts incorporating the history you've pushed while the former kind of
hook only runs when the repository's object database is updated.  Hence
post-receive is for linting -- where you might decide to fail pushing
for some reason, and post-update is for making use of the state just
pushed.

Now let's move on to the deployment phase.
You have used the word pushing so it's unclear if you really mean
using Git to sync whatever Pelican generates with your production
server.
While this is possible -- just turn Pelican's output directory into a
regular Git repository and use `git add -A` + `git commit` there after
Pelican finished running, -- IMO this needlessly complicates things and
I'd better use rsync (or unison or whatever) or git-ftp [1].

1. https://github.com/git-ftp/git-ftp

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Deploying a static website to local and production servers

2015-06-02 Thread Konstantin Khomoutov
On Tue, 2 Jun 2015 18:09:52 +0300
Konstantin Khomoutov flatw...@users.sourceforge.net wrote:

(Cc'd Nick, who recently asked a question about GIT_DIR.)

[...]
 But that's not required for having your files checked out.  90% of
 random HOWTOs you're able to google using git+web+deployment explain
 exactly this scenario: there's only a bare repository on the target
 server, and the files from the tip commit among those just pushed
 get checked out to some arbitrary directory.  Most of the time this is
 done via environment variables, namely, GIT_DIR, GIT_WORK_TREE and
 GIT_INDEX_FILE environment variables.
[...]

To be more clear, these environment variables are documented in the
git(1) manual page -- that is, the manual of the root git command.
You can get it by running `git help git`.

A good informal introduction to this stuff is [1].

1. https://git-scm.com/blog/2010/04/11/environment.html

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Avoid EOL hell

2015-06-02 Thread Rustom Mody
Setting up for a project in which both linux and windows will be the OSes.

After spending some time searching for solutions I am as confused as ever.
What are the optimum crlf settings so that files (maybe of designated
types, say
.c and .h files) are CRLF on windows and LF on linux?

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Avoid EOL hell

2015-06-02 Thread Konstantin Khomoutov
On Tue, 2 Jun 2015 22:09:46 +0530
Rustom Mody rustompm...@gmail.com wrote:

 Setting up for a project in which both linux and windows will be the
 OSes.
 
 After spending some time searching for solutions I am as confused as
 ever. What are the optimum crlf settings so that files (maybe of
 designated types, say
 .c and .h files) are CRLF on windows and LF on linux?

I recommend reading through [1].

In short, core.autocrlf set to auto on Windows should, in theory,
ensure that the text files have CRLF EOLs in the work tree and LFs
in the index and the object store.  But that's, well, in theory, and
you might need to cater for the bogosity of particular tools.

(I'm assuming you're using Git for Windows on Windows.  Cygwin's Git
lives in its own POSIX-y world and considers LFs to be the platform's
native EOLs.  The installer of GfW sets core.autocrlf to auto
by default, and, AFAIK, there's no way to tell it not to.)

1. https://github.com/mono/mono/blob/master/.gitattributes

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.