libgit2 / libgit2/libgit2sharp

View Incoming Commits from a Pre-Receive Hook

Aberta
#1,977 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Linguagem predominante
C#
Estrelas
3.5k
Forks
925
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

I have developed a pre-receive hook using C#/.NET and used libgit2sharp to retrieve the commits that are being pushed from the client. When I access the Repository.Commits, I only see the old commits not the ones that are being pushed.

I tried using a bash script to implement the hook and execute git rev-list $rev_old..$rev_new and it works and I can see the commits.

So, I'm wondering why does the bash script work and the C#/.NET executable does not given that both executables are executing on the same working directory that Git assigns to the hook.

P.S. I'm using BitBucket Server on-premise deployment - it shouldn't matter I think because the hook works at the Git level not BitBucket

Reproduction steps
  1. Create a .NET 6.0 Console application and add a reference to libgit2sharp.
  2. Write code to obtain the commits between the old ref and the new ref as provided by Git.
  3. Build and configure the hook on the Git repository directory.
  4. Use a Git client to push commits to the server.
Expected behavior

The commits coming from the client should be seen when the Repository.Commits is enumerated.

Actual behavior

Only the commits before the push are returned not the incoming commits.

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

Ubuntu 18.04 and .NET 6.0

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece reproduzindo o pre-receive hook com libgit2sharp 0.26.2 no Ubuntu 18.04 e no .NET 6.0, comparando Repository.Commits com os valores de ref antigo e novo fornecidos pelo Git. Leia os argumentos de ref do hook e o comportamento de Repository.Commits; considera-se concluído quando os commits recebidos forem observáveis ou quando a limitação e o uso correto estiverem documentados.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
csharp, git
Domínio
tooling
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.