How to check gitolite configuration file syntax before using it? - gitolite

I would like to check the syntax of the gitolite configuration file conf/gitolite.conf before using (pushing) it. Is there a way to achieve that?

Before pushing?
I don't see how.
The gitolite.conf file is parse by the Conf.pm#parse function, but that happens only on the gitolite server side (where you are pushing that file).
Note on the client side (where you have only a gitolite-admin cloned repo)

VonC was right, one can use the parse function, but it is limited.
See this answer from Sitaram (Gitolite developer) to my question:
https://groups.google.com/forum/#!topic/gitolite/-YIh7yzBI2Y
It has a little (untested) code snippet to check the syntax.

Related

Retrieve the commit hash

I'm currently working on a deployment script to run as part of my GitLab CI setup. What I want is to copy a file from one location to another and rename it.
Now I want to be able to find what commit that file was generated with, so I'd like to add the hash of the commit to it.
For that to work I'd like to use something like this:
cp myLogFile.log /var/log/gitlab-runs/$COMMITHASH.log
The output should be a file named eg.
/var/log/gitlab-runs/9b43adf.log
How is this possible to achieve using GitLab CI?
In your example you used the short git hash that you would get with the predefined variable CI_COMMIT_SHA by building a substring like this:
${CI_COMMIT_SHA:0:8}
or by using the short sha directly
$CI_COMMIT_SHORT_SHA
The variable you are looking for is CI_COMMIT_SHA (formerly CI_BUILD_REF in GitLab 8.x and earlier) which one of the predefined variables.
All predefined variables are listed here.
Since GitLab v11.7 you can use $CI_COMMIT_SHORT_SHA which returns the first eight characters of CI_COMMIT_SHA.

Understanding how libzip works

I have started working with the libzip library today. But I do not understand the principle how libzip works.
My focus is on zipping a directory with all the files and dirs within
into a zip-file.
Therefore, I started with zip_open(), then I read the directory
contents and add all the dirs with zip_dir_add() to the archive.
After that, I closed the zip-file with zip_close(). Everything was
fine. The next step should be to add all the files to the archive with
zip_file_add(). But it doesn't work. The last step closing the file
fails.
OK, I forgot to create a zip_source to get this done. I added a
statement a line before to get this source (zip_source_file()). But
still it doesn't work.
What is wrong in my thinking? Do I have to fopen() and fclose() the file on the filesystem also?
And what is the difference between zip_source_file() and zip_source_filep()?
Do I have to fopen() and fclose() the file on the filesystem also?
No, you can just use zip_source_file().
From your comments I think you have the right general idea, but there is probably some detail that is making it fail. Make sure you perform all the error checking the documentation suggests after each libzip call so you can get more information about what is causing it to fail.
You could also compare your code with https://gist.github.com/clalancette/bb5069a09c609e2d33c9858fcc6e170e

GIT. Web interface (Node.js). Wrong encoding

I'm trying to build web interface for GIT on Node.js.
Currently I have one problem: wrong Unicode encoding while 'git commit'. Commit message are shown in gibberish in log. And I have no clue on which step in which way I need to correct.
At this point I have:
1) UTF-8 encoded HTML page for interface;
2) Node.js child_process.spawn() to execute git commands;
3) ["-C",repo.path,"commit","-m",post.msg] as an argument list to pass to git;
When I execute the same command from git shell (Under Windows if it matters) - everything is fine.
Any suggestions?
Thanks in advance!
Update
I guess I won't have this question answered, but still add one detail:
it feels like somewhere message is converted from UTF8 to ISO 8859-1
Update2
Looks like 8859-1 - is my default CMD.exe (who proceed my commands) encoding... still have no idea on what to do with it.
The cause of problem was not about git, cmd or node.js. It was my stupid mistake.
On client I wrapped data into encodeURIComponent before send. On server unwrapped it with unescape. It took too much time to notice it.
Now, after I replaced unescape by decodeURIComponent, it works perfectly well.

Layering projects on top of each other with git

Let there be:
There are different repositories repoA, repoB and repoC each respecting the same directory layout principles, which are to be merged onto a third repoM's working directory (the "master" project).
repoM has an atypical setup (--work-dir and --git-dir are sepparate). repo[A-C] are cloned as bare, and they are set as core.bare = false and core.worktree=<--work-dir-of-repoM>.
The requirements:
I need to always have an overview over the history of all files in repoM's work-dir, which could have stemmed from repo[A-C]. With this approach, I lose all that information.
Alternative:
I've been thinking about using git-subtree instead (git version 1.7.11.2, so it's already built-in), leaving repo[A-C] bare, and then
git pull -s subtree, or
git subtree ...
With the subtree pull strategy, I lose the history on a merge conflict (git blame says so).
I've never used subtree before, but from my understanding it's not possible to merge files from repo[A-C] into repoM's work-dir, those files must be put into a subdirectory of repo[A-C]. This is definitely not what I need. Why? Because of the following ...
Problem statement:
You have different git repositories each containing different sets of files, usually configuration files and some shell scripts. You want to put everything in the $HOME (which is <--work-dir-of-repoM>) directory from all those repositories. You should be able to see at all time where each file comes from, edit, commit and push changes to each one's origin. You've guessed it, it something like vundle, but generalized for any kind of configuration of any program, not just vim bundles. If a conflict occures, one should be able to track down which two authors of the same file need to get in touch with each other and make up a deal (if one needs to be made).
This is for an open-source project I'm trying to get a prototype working, so any help is highly appreciated. Also ideas about already existing projects which do this in a similar manner are highly appreciated.
Note: the "master directory" does not necessarily have to be $HOME, I've used it as a possible hint on the kind of problem this could solve.
Why not simply use Git Submodules in your "master project"?

CruiseControl.Net Modification Reader Example?

Does anyone have any example of how to use modification reader task?
Ok, I use this over XML:
<modificationReader>
<filename>mods.xml</filename>
<path>path/to/my/file/</path>
</modificationReader>
then, what? How do I get the information in "mods.xml" and use it?
Thanks
This appears to be used with the modificationWriter task which writes the modifications to a file (in the artifact directory by default).
http://build.sharpdevelop.net/ccnet/doc/CCNET/Modification%20Writer%20Task.html
If you're just trying to read in the modifications in to a different projects' buildLog, the above - with a path to the first project - should be sufficient.
Are you trying to do something different?
CruiseControl.NET: Build subproject obtained by SVN

Resources